home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.88.11.sit / 001. Sample / Sample.c < prev    next >
MacBinary  |  1988-11-02  |  31.3 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
20% dexvert Doodle Atari (image/doodleAtari) fileSize Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Nov 1 20:54:25 1988, modified Tue Nov 1 20:54:25 1988, creator 'MPS ', type ASCII, 31431 bytes "Sample.c" , at 0x7b47 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 63 00 00 00 00 00 00 |..Sample|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 7a c7 00 | 00 01 7e 9f 94 1b 51 9f |.....z..|..~...Q.|
|00000060| 94 1b 51 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..Q.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 3e 8e 00 00 |........|....>...|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 53 61 |-Aware S|imple Sa|
|00000120| 6d 70 6c 65 20 41 70 70 | 6c 69 63 61 74 69 6f 6e |mple App|lication|
|00000130| 0d 23 0d 23 09 53 61 6d | 70 6c 65 0d 23 0d 23 09 |.#.#.Sam|ple.#.#.|
|00000140| 53 61 6d 70 6c 65 2e 63 | 09 2d 09 43 20 53 6f 75 |Sample.c|.-.C Sou|
|00000150| 72 63 65 0d 23 0d 23 09 | 43 6f 70 79 72 69 67 68 |rce.#.#.|Copyrigh|
|00000160| 74 20 a9 20 31 39 38 38 | 20 41 70 70 6c 65 20 43 |t . 1988| Apple C|
|00000170| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 23 09 |omputer,| Inc..#.|
|00000180| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|00000190| 76 65 64 2e 0d 23 0d 23 | 09 56 65 72 73 69 6f 6e |ved..#.#|.Version|
|000001a0| 73 3a 09 31 2e 30 09 09 | 09 09 09 30 38 2f 38 38 |s:.1.0..|...08/88|
|000001b0| 0d 23 09 09 09 09 31 2e | 30 31 09 09 09 09 31 31 |.#....1.|01....11|
|000001c0| 2f 38 38 0d 23 0d 23 09 | 43 6f 6d 70 6f 6e 65 6e |/88.#.#.|Componen|
|000001d0| 74 73 3a 09 53 61 6d 70 | 6c 65 2e 70 09 09 09 4e |ts:.Samp|le.p...N|
|000001e0| 6f 76 65 6d 62 65 72 20 | 31 2c 20 31 39 38 38 0d |ovember |1, 1988.|
|000001f0| 23 09 09 09 09 53 61 6d | 70 6c 65 2e 63 09 09 09 |#....Sam|ple.c...|
|00000200| 4e 6f 76 65 6d 62 65 72 | 20 31 2c 20 31 39 38 38 |November| 1, 1988|
|00000210| 0d 23 09 09 09 09 53 61 | 6d 70 6c 65 2e 61 09 09 |.#....Sa|mple.a..|
|00000220| 09 4e 6f 76 65 6d 62 65 | 72 20 31 2c 20 31 39 38 |.Novembe|r 1, 198|
|00000230| 38 0d 23 09 09 09 09 53 | 61 6d 70 6c 65 2e 69 6e |8.#....S|ample.in|
|00000240| 63 31 2e 61 09 09 4e 6f | 76 65 6d 62 65 72 20 31 |c1.a..No|vember 1|
|00000250| 2c 20 31 39 38 38 0d 23 | 09 09 09 09 53 61 6d 70 |, 1988.#|....Samp|
|00000260| 6c 65 4d 69 73 63 2e 61 | 09 09 4e 6f 76 65 6d 62 |leMisc.a|..Novemb|
|00000270| 65 72 20 31 2c 20 31 39 | 38 38 0d 23 09 09 09 09 |er 1, 19|88.#....|
|00000280| 53 61 6d 70 6c 65 2e 72 | 09 09 09 4e 6f 76 65 6d |Sample.r|...Novem|
|00000290| 62 65 72 20 31 2c 20 31 | 39 38 38 0d 23 09 09 09 |ber 1, 1|988.#...|
|000002a0| 09 53 61 6d 70 6c 65 2e | 68 09 09 09 4e 6f 76 65 |.Sample.|h...Nove|
|000002b0| 6d 62 65 72 20 31 2c 20 | 31 39 38 38 0d 23 09 09 |mber 1, |1988.#..|
|000002c0| 09 09 50 53 61 6d 70 6c | 65 2e 6d 61 6b 65 09 09 |..PSampl|e.make..|
|000002d0| 4e 6f 76 65 6d 62 65 72 | 20 31 2c 20 31 39 38 38 |November| 1, 1988|
|000002e0| 0d 23 09 09 09 09 43 53 | 61 6d 70 6c 65 2e 6d 61 |.#....CS|ample.ma|
|000002f0| 6b 65 09 09 4e 6f 76 65 | 6d 62 65 72 20 31 2c 20 |ke..Nove|mber 1, |
|00000300| 31 39 38 38 0d 23 09 09 | 09 09 41 53 61 6d 70 6c |1988.#..|..ASampl|
|00000310| 65 2e 6d 61 6b 65 09 09 | 4e 6f 76 65 6d 62 65 72 |e.make..|November|
|00000320| 20 31 2c 20 31 39 38 38 | 0d 23 0d 23 09 53 61 6d | 1, 1988|.#.#.Sam|
|00000330| 70 6c 65 20 69 73 20 61 | 6e 20 65 78 61 6d 70 6c |ple is a|n exampl|
|00000340| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 74 68 |e applic|ation th|
|00000350| 61 74 20 64 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |at demon|strates |
|00000360| 68 6f 77 20 74 6f 0d 23 | 09 69 6e 69 74 69 61 6c |how to.#|.initial|
|00000370| 69 7a 65 20 74 68 65 20 | 63 6f 6d 6d 6f 6e 6c 79 |ize the |commonly|
|00000380| 20 75 73 65 64 20 74 6f | 6f 6c 62 6f 78 20 6d 61 | used to|olbox ma|
|00000390| 6e 61 67 65 72 73 2c 20 | 6f 70 65 72 61 74 65 20 |nagers, |operate |
|000003a0| 0d 23 09 73 75 63 63 65 | 73 73 66 75 6c 6c 79 20 |.#.succe|ssfully |
|000003b0| 75 6e 64 65 72 20 4d 75 | 6c 74 69 46 69 6e 64 65 |under Mu|ltiFinde|
|000003c0| 72 2c 20 68 61 6e 64 6c | 65 20 64 65 73 6b 20 61 |r, handl|e desk a|
|000003d0| 63 63 65 73 73 6f 72 69 | 65 73 2c 20 0d 23 09 61 |ccessori|es, .#.a|
|000003e0| 6e 64 20 63 72 65 61 74 | 65 2c 20 67 72 6f 77 2c |nd creat|e, grow,|
|000003f0| 20 61 6e 64 20 7a 6f 6f | 6d 20 77 69 6e 64 6f 77 | and zoo|m window|
|00000400| 73 2e 0d 23 0d 23 09 49 | 74 20 64 6f 65 73 20 6e |s..#.#.I|t does n|
|00000410| 6f 74 20 62 79 20 61 6e | 79 20 6d 65 61 6e 73 20 |ot by an|y means |
|00000420| 64 65 6d 6f 6e 73 74 72 | 61 74 65 20 61 6c 6c 20 |demonstr|ate all |
|00000430| 74 68 65 20 74 65 63 68 | 6e 69 71 75 65 73 20 0d |the tech|niques .|
|00000440| 23 09 79 6f 75 20 6e 65 | 65 64 20 66 6f 72 20 61 |#.you ne|ed for a|
|00000450| 20 6c 61 72 67 65 20 61 | 70 70 6c 69 63 61 74 69 | large a|pplicati|
|00000460| 6f 6e 2e 20 49 6e 20 70 | 61 72 74 69 63 75 6c 61 |on. In p|articula|
|00000470| 72 2c 20 53 61 6d 70 6c | 65 20 0d 23 09 64 6f 65 |r, Sampl|e .#.doe|
|00000480| 73 20 6e 6f 74 20 63 6f | 76 65 72 20 65 78 63 65 |s not co|ver exce|
|00000490| 70 74 69 6f 6e 20 68 61 | 6e 64 6c 69 6e 67 2c 20 |ption ha|ndling, |
|000004a0| 6d 75 6c 74 69 70 6c 65 | 20 77 69 6e 64 6f 77 73 |multiple| windows|
|000004b0| 2f 64 6f 63 75 6d 65 6e | 74 73 2c 20 0d 23 09 73 |/documen|ts, .#.s|
|000004c0| 6f 70 68 69 73 74 69 63 | 61 74 65 64 20 6d 65 6d |ophistic|ated mem|
|000004d0| 6f 72 79 20 6d 61 6e 61 | 67 65 6d 65 6e 74 2c 20 |ory mana|gement, |
|000004e0| 70 72 69 6e 74 69 6e 67 | 2c 20 6f 72 20 75 6e 64 |printing|, or und|
|000004f0| 6f 2e 20 41 6c 6c 20 6f | 66 20 0d 23 09 74 68 65 |o. All o|f .#.the|
|00000500| 73 65 20 61 72 65 20 76 | 69 74 61 6c 20 70 61 72 |se are v|ital par|
|00000510| 74 73 20 6f 66 20 61 20 | 6e 6f 72 6d 61 6c 20 66 |ts of a |normal f|
|00000520| 75 6c 6c 2d 73 69 7a 65 | 64 20 61 70 70 6c 69 63 |ull-size|d applic|
|00000530| 61 74 69 6f 6e 2e 0d 23 | 0d 23 09 54 68 69 73 20 |ation..#|.#.This |
|00000540| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 61 |applicat|ion is a|
|00000550| 6e 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 65 |n exampl|e of the|
|00000560| 20 66 6f 72 6d 20 6f 66 | 20 61 20 4d 61 63 69 6e | form of| a Macin|
|00000570| 74 6f 73 68 20 0d 23 09 | 61 70 70 6c 69 63 61 74 |tosh .#.|applicat|
|00000580| 69 6f 6e 3b 20 69 74 20 | 69 73 20 4e 4f 54 20 61 |ion; it |is NOT a|
|00000590| 20 74 65 6d 70 6c 61 74 | 65 2e 20 49 74 20 69 73 | templat|e. It is|
|000005a0| 20 4e 4f 54 20 69 6e 74 | 65 6e 64 65 64 20 74 6f | NOT int|ended to|
|000005b0| 20 62 65 20 0d 23 09 75 | 73 65 64 20 61 73 20 61 | be .#.u|sed as a|
|000005c0| 20 66 6f 75 6e 64 61 74 | 69 6f 6e 20 66 6f 72 20 | foundat|ion for |
|000005d0| 74 68 65 20 6e 65 78 74 | 20 77 6f 72 6c 64 2d 63 |the next| world-c|
|000005e0| 6c 61 73 73 2c 20 62 65 | 73 74 2d 73 65 6c 6c 69 |lass, be|st-selli|
|000005f0| 6e 67 2c 20 0d 23 09 36 | 30 30 4b 20 61 70 70 6c |ng, .#.6|00K appl|
|00000600| 69 63 61 74 69 6f 6e 2e | 20 41 20 73 74 69 63 6b |ication.| A stick|
|00000610| 20 66 69 67 75 72 65 20 | 64 72 61 77 69 6e 67 20 | figure |drawing |
|00000620| 6f 66 20 74 68 65 20 68 | 75 6d 61 6e 20 62 6f 64 |of the h|uman bod|
|00000630| 79 20 6d 61 79 20 0d 23 | 09 62 65 20 61 20 67 6f |y may .#|.be a go|
|00000640| 6f 64 20 65 78 61 6d 70 | 6c 65 20 6f 66 20 74 68 |od examp|le of th|
|00000650| 65 20 66 6f 72 6d 20 66 | 6f 72 20 61 20 70 61 69 |e form f|or a pai|
|00000660| 6e 74 69 6e 67 2c 20 62 | 75 74 20 74 68 61 74 20 |nting, b|ut that |
|00000670| 64 6f 65 73 20 6e 6f 74 | 20 0d 23 09 6d 65 61 6e |does not| .#.mean|
|00000680| 20 69 74 20 73 68 6f 75 | 6c 64 20 62 65 20 75 73 | it shou|ld be us|
|00000690| 65 64 20 61 73 20 74 68 | 65 20 62 61 73 69 73 20 |ed as th|e basis |
|000006a0| 66 6f 72 20 74 68 65 20 | 6e 65 78 74 20 4d 6f 6e |for the |next Mon|
|000006b0| 61 20 4c 69 73 61 2e 0d | 23 0d 23 09 57 65 20 72 |a Lisa..|#.#.We r|
|000006c0| 65 63 6f 6d 6d 65 6e 64 | 20 74 68 61 74 20 79 6f |ecommend| that yo|
|000006d0| 75 20 72 65 76 69 65 77 | 20 74 68 69 73 20 70 72 |u review| this pr|
|000006e0| 6f 67 72 61 6d 20 6f 72 | 20 54 45 53 61 6d 70 6c |ogram or| TESampl|
|000006f0| 65 20 62 65 66 6f 72 65 | 20 0d 23 09 62 65 67 69 |e before| .#.begi|
|00000700| 6e 6e 69 6e 67 20 61 20 | 6e 65 77 20 61 70 70 6c |nning a |new appl|
|00000710| 69 63 61 74 69 6f 6e 2e | 0d 23 0d 2d 2d 2d 2d 2d |ication.|.#.-----|
|00000720| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2a 2f 0d 0d 0d 2f 2a |--------|-*/.../*|
|00000770| 20 53 65 67 6d 65 6e 74 | 61 74 69 6f 6e 20 73 74 | Segment|ation st|
|00000780| 72 61 74 65 67 79 3a 0d | 0d 20 20 20 54 68 69 73 |rategy:.|. This|
|00000790| 20 70 72 6f 67 72 61 6d | 20 63 6f 6e 73 69 73 74 | program| consist|
|000007a0| 73 20 6f 66 20 74 68 72 | 65 65 20 73 65 67 6d 65 |s of thr|ee segme|
|000007b0| 6e 74 73 2e 20 4d 61 69 | 6e 20 63 6f 6e 74 61 69 |nts. Mai|n contai|
|000007c0| 6e 73 20 6d 6f 73 74 20 | 6f 66 20 74 68 65 20 63 |ns most |of the c|
|000007d0| 6f 64 65 2c 0d 20 20 20 | 69 6e 63 6c 75 64 69 6e |ode,. |includin|
|000007e0| 67 20 74 68 65 20 4d 50 | 57 20 6c 69 62 72 61 72 |g the MP|W librar|
|000007f0| 69 65 73 2c 20 61 6e 64 | 20 74 68 65 20 6d 61 69 |ies, and| the mai|
|00000800| 6e 20 70 72 6f 67 72 61 | 6d 2e 20 49 6e 69 74 69 |n progra|m. Initi|
|00000810| 61 6c 69 7a 65 20 63 6f | 6e 74 61 69 6e 73 0d 20 |alize co|ntains. |
|00000820| 20 20 63 6f 64 65 20 74 | 68 61 74 20 69 73 20 6f | code t|hat is o|
|00000830| 6e 6c 79 20 75 73 65 64 | 20 6f 6e 63 65 2c 20 64 |nly used| once, d|
|00000840| 75 72 69 6e 67 20 73 74 | 61 72 74 75 70 2c 20 61 |uring st|artup, a|
|00000850| 6e 64 20 63 61 6e 20 62 | 65 20 75 6e 6c 6f 61 64 |nd can b|e unload|
|00000860| 65 64 20 61 66 74 65 72 | 20 74 68 65 0d 20 20 20 |ed after| the. |
|00000870| 70 72 6f 67 72 61 6d 20 | 73 74 61 72 74 73 2e 20 |program |starts. |
|00000880| 25 41 35 49 6e 69 74 20 | 69 73 20 61 75 74 6f 6d |%A5Init |is autom|
|00000890| 61 74 69 63 61 6c 6c 79 | 20 63 72 65 61 74 65 64 |atically| created|
|000008a0| 20 62 79 20 74 68 65 20 | 4c 69 6e 6b 65 72 20 74 | by the |Linker t|
|000008b0| 6f 20 69 6e 69 74 69 61 | 6c 69 7a 65 0d 20 20 20 |o initia|lize. |
|000008c0| 67 6c 6f 62 61 6c 73 20 | 66 6f 72 20 74 68 65 20 |globals |for the |
|000008d0| 4d 50 57 20 6c 69 62 72 | 61 72 69 65 73 20 61 6e |MPW libr|aries an|
|000008e0| 64 20 69 73 20 75 6e 6c | 6f 61 64 65 64 20 72 69 |d is unl|oaded ri|
|000008f0| 67 68 74 20 61 77 61 79 | 2e 20 2a 2f 0d 0d 0d 2f |ght away|. */.../|
|00000900| 2a 20 53 65 74 50 6f 72 | 74 20 73 74 72 61 74 65 |* SetPor|t strate|
|00000910| 67 79 3a 0d 0d 20 20 20 | 54 6f 6f 6c 62 6f 78 20 |gy:.. |Toolbox |
|00000920| 72 6f 75 74 69 6e 65 73 | 20 64 6f 20 6e 6f 74 20 |routines| do not |
|00000930| 63 68 61 6e 67 65 20 74 | 68 65 20 63 75 72 72 65 |change t|he curre|
|00000940| 6e 74 20 70 6f 72 74 2e | 20 49 6e 20 73 70 69 74 |nt port.| In spit|
|00000950| 65 20 6f 66 20 74 68 69 | 73 2c 20 69 6e 20 74 68 |e of thi|s, in th|
|00000960| 69 73 0d 20 20 20 70 72 | 6f 67 72 61 6d 20 77 65 |is. pr|ogram we|
|00000970| 20 75 73 65 20 61 20 73 | 74 72 61 74 65 67 79 20 | use a s|trategy |
|00000980| 6f 66 20 63 61 6c 6c 69 | 6e 67 20 53 65 74 50 6f |of calli|ng SetPo|
|00000990| 72 74 20 77 68 65 6e 65 | 76 65 72 20 77 65 20 77 |rt whene|ver we w|
|000009a0| 61 6e 74 20 74 6f 20 64 | 72 61 77 20 6f 72 0d 20 |ant to d|raw or. |
|000009b0| 20 20 6d 61 6b 65 20 63 | 61 6c 6c 73 20 77 68 69 | make c|alls whi|
|000009c0| 63 68 20 64 65 70 65 6e | 64 20 6f 6e 20 74 68 65 |ch depen|d on the|
|000009d0| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 2e 20 54 | current| port. T|
|000009e0| 68 69 73 20 6d 61 6b 65 | 73 20 75 73 20 6c 65 73 |his make|s us les|
|000009f0| 73 20 76 75 6c 6e 65 72 | 61 62 6c 65 0d 20 20 20 |s vulner|able. |
|00000a00| 74 6f 20 62 75 67 73 20 | 69 6e 20 6f 74 68 65 72 |to bugs |in other|
|00000a10| 20 73 6f 66 74 77 61 72 | 65 20 77 68 69 63 68 20 | softwar|e which |
|00000a20| 6d 69 67 68 74 20 61 6c | 74 65 72 20 74 68 65 20 |might al|ter the |
|00000a30| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 20 28 73 75 |current |port (su|
|00000a40| 63 68 20 61 73 20 74 68 | 65 0d 20 20 20 62 75 67 |ch as th|e. bug|
|00000a50| 20 28 66 65 61 74 75 72 | 65 3f 29 20 69 6e 20 6d | (featur|e?) in m|
|00000a60| 61 6e 79 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |any desk| accesso|
|00000a70| 72 69 65 73 20 77 68 69 | 63 68 20 63 68 61 6e 67 |ries whi|ch chang|
|00000a80| 65 20 74 68 65 20 70 6f | 72 74 20 6f 6e 20 4f 70 |e the po|rt on Op|
|00000a90| 65 6e 44 65 73 6b 41 63 | 63 29 2e 0d 20 20 20 48 |enDeskAc|c).. H|
|00000aa0| 6f 70 65 66 75 6c 6c 79 | 2c 20 74 68 69 73 20 61 |opefully|, this a|
|00000ab0| 6c 73 6f 20 6d 61 6b 65 | 73 20 74 68 65 20 72 6f |lso make|s the ro|
|00000ac0| 75 74 69 6e 65 73 20 66 | 72 6f 6d 20 74 68 69 73 |utines f|rom this|
|00000ad0| 20 70 72 6f 67 72 61 6d | 20 6d 6f 72 65 20 73 65 | program| more se|
|00000ae0| 6c 66 2d 63 6f 6e 74 61 | 69 6e 65 64 2c 0d 20 20 |lf-conta|ined,. |
|00000af0| 20 73 69 6e 63 65 20 74 | 68 65 79 20 64 6f 6e 27 | since t|hey don'|
|00000b00| 74 20 64 65 70 65 6e 64 | 20 6f 6e 20 74 68 65 20 |t depend| on the |
|00000b10| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 20 73 65 74 |current |port set|
|00000b20| 74 69 6e 67 2e 20 2a 2f | 0d 0d 0d 23 69 6e 63 6c |ting. */|...#incl|
|00000b30| 75 64 65 20 3c 56 61 6c | 75 65 73 2e 68 3e 0d 23 |ude <Val|ues.h>.#|
|00000b40| 69 6e 63 6c 75 64 65 20 | 3c 54 79 70 65 73 2e 68 |include |<Types.h|
|00000b50| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 52 65 73 6f |>.#inclu|de <Reso|
|00000b60| 75 72 63 65 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |urces.h>|.#includ|
|00000b70| 65 20 3c 51 75 69 63 6b | 44 72 61 77 2e 68 3e 0d |e <Quick|Draw.h>.|
|00000b80| 23 69 6e 63 6c 75 64 65 | 20 3c 46 6f 6e 74 73 2e |#include| <Fonts.|
|00000b90| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 45 76 65 |h>.#incl|ude <Eve|
|00000ba0| 6e 74 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |nts.h>.#|include |
|00000bb0| 3c 57 69 6e 64 6f 77 73 | 2e 68 3e 0d 23 69 6e 63 |<Windows|.h>.#inc|
|00000bc0| 6c 75 64 65 20 3c 4d 65 | 6e 75 73 2e 68 3e 0d 23 |lude <Me|nus.h>.#|
|00000bd0| 69 6e 63 6c 75 64 65 20 | 3c 54 65 78 74 45 64 69 |include |<TextEdi|
|00000be0| 74 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 44 |t.h>.#in|clude <D|
|00000bf0| 69 61 6c 6f 67 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ialogs.h|>.#inclu|
|00000c00| 64 65 20 3c 44 65 73 6b | 2e 68 3e 0d 23 69 6e 63 |de <Desk|.h>.#inc|
|00000c10| 6c 75 64 65 20 3c 54 6f | 6f 6c 55 74 69 6c 73 2e |lude <To|olUtils.|
|00000c20| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 4d 65 6d |h>.#incl|ude <Mem|
|00000c30| 6f 72 79 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ory.h>.#|include |
|00000c40| 3c 53 65 67 4c 6f 61 64 | 2e 68 3e 0d 23 69 6e 63 |<SegLoad|.h>.#inc|
|00000c50| 6c 75 64 65 20 3c 46 69 | 6c 65 73 2e 68 3e 0d 23 |lude <Fi|les.h>.#|
|00000c60| 69 6e 63 6c 75 64 65 20 | 3c 4f 53 55 74 69 6c 73 |include |<OSUtils|
|00000c70| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 44 69 |.h>.#inc|lude <Di|
|00000c80| 73 6b 49 6e 69 74 2e 68 | 3e 0d 23 69 6e 63 6c 75 |skInit.h|>.#inclu|
|00000c90| 64 65 20 3c 50 61 63 6b | 61 67 65 73 2e 68 3e 0d |de <Pack|ages.h>.|
|00000ca0| 23 69 6e 63 6c 75 64 65 | 20 3c 54 72 61 70 73 2e |#include| <Traps.|
|00000cb0| 68 3e 09 09 2f 2a 20 4d | 50 57 20 32 2e 30 2e 32 |h>../* M|PW 2.0.2|
|00000cc0| 20 54 72 61 70 73 2e 68 | 20 69 73 20 6d 69 73 73 | Traps.h| is miss|
|00000cd0| 69 6e 67 20 61 6e 20 23 | 65 6e 64 69 66 20 2a 2f |ing an #|endif */|
|00000ce0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 53 61 6d 70 6c |.#includ|e <Sampl|
|00000cf0| 65 2e 68 3e 09 09 2f 2a | 20 62 72 69 6e 67 20 69 |e.h>../*| bring i|
|00000d00| 6e 20 61 6c 6c 20 74 68 | 65 20 23 64 65 66 69 6e |n all th|e #defin|
|00000d10| 65 73 20 66 6f 72 20 53 | 61 6d 70 6c 65 20 2a 2f |es for S|ample */|
|00000d20| 0d 0d 0d 2f 2a 20 54 68 | 65 20 22 67 22 20 70 72 |.../* Th|e "g" pr|
|00000d30| 65 66 69 78 20 69 73 20 | 75 73 65 64 20 74 6f 20 |efix is |used to |
|00000d40| 65 6d 70 68 61 73 69 7a | 65 20 74 68 61 74 20 61 |emphasiz|e that a|
|00000d50| 20 76 61 72 69 61 62 6c | 65 20 69 73 20 67 6c 6f | variabl|e is glo|
|00000d60| 62 61 6c 2e 20 2a 2f 0d | 0d 2f 2a 20 47 4d 61 63 |bal. */.|./* GMac|
|00000d70| 20 69 73 20 75 73 65 64 | 20 74 6f 20 68 6f 6c 64 | is used| to hold|
|00000d80| 20 74 68 65 20 72 65 73 | 75 6c 74 20 6f 66 20 61 | the res|ult of a|
|00000d90| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 20 63 61 6c | SysEnvi|rons cal|
|00000da0| 6c 2e 20 54 68 69 73 20 | 6d 61 6b 65 73 0d 20 20 |l. This |makes. |
|00000db0| 20 69 74 20 63 6f 6e 76 | 65 6e 69 65 6e 74 20 66 | it conv|enient f|
|00000dc0| 6f 72 20 61 6e 79 20 72 | 6f 75 74 69 6e 65 20 74 |or any r|outine t|
|00000dd0| 6f 20 63 68 65 63 6b 20 | 74 68 65 20 65 6e 76 69 |o check |the envi|
|00000de0| 72 6f 6e 6d 65 6e 74 2e | 20 2a 2f 0d 53 79 73 45 |ronment.| */.SysE|
|00000df0| 6e 76 52 65 63 09 67 4d | 61 63 3b 09 09 09 09 2f |nvRec.gM|ac;..../|
|00000e00| 2a 20 73 65 74 20 75 70 | 20 62 79 20 49 6e 69 74 |* set up| by Init|
|00000e10| 69 61 6c 69 7a 65 20 2a | 2f 0d 0d 2f 2a 20 47 48 |ialize *|/../* GH|
|00000e20| 61 73 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 20 |asWaitNe|xtEvent |
|00000e30| 69 73 20 73 65 74 20 61 | 74 20 73 74 61 72 74 75 |is set a|t startu|
|00000e40| 70 2c 20 61 6e 64 20 74 | 65 6c 6c 73 20 77 68 65 |p, and t|ells whe|
|00000e50| 74 68 65 72 20 74 68 65 | 20 57 61 69 74 4e 65 78 |ther the| WaitNex|
|00000e60| 74 45 76 65 6e 74 0d 20 | 20 20 74 72 61 70 20 69 |tEvent. | trap i|
|00000e70| 73 20 61 76 61 69 6c 61 | 62 6c 65 2e 20 49 66 20 |s availa|ble. If |
|00000e80| 69 74 20 69 73 20 66 61 | 6c 73 65 2c 20 77 65 20 |it is fa|lse, we |
|00000e90| 6b 6e 6f 77 20 74 68 61 | 74 20 77 65 20 6d 75 73 |know tha|t we mus|
|00000ea0| 74 20 63 61 6c 6c 20 47 | 65 74 4e 65 78 74 45 76 |t call G|etNextEv|
|00000eb0| 65 6e 74 2e 20 2a 2f 0d | 42 6f 6f 6c 65 61 6e 09 |ent. */.|Boolean.|
|00000ec0| 09 67 48 61 73 57 61 69 | 74 4e 65 78 74 45 76 65 |.gHasWai|tNextEve|
|00000ed0| 6e 74 3b 09 2f 2a 20 73 | 65 74 20 75 70 20 62 79 |nt;./* s|et up by|
|00000ee0| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 2a 2f 0d 0d | Initial|ize */..|
|00000ef0| 2f 2a 20 47 49 6e 42 61 | 63 6b 67 72 6f 75 6e 64 |/* GInBa|ckground|
|00000f00| 20 69 73 20 6d 61 69 6e | 74 61 69 6e 65 64 20 62 | is main|tained b|
|00000f10| 79 20 6f 75 72 20 6f 73 | 45 76 65 6e 74 20 68 61 |y our os|Event ha|
|00000f20| 6e 64 6c 69 6e 67 20 72 | 6f 75 74 69 6e 65 73 2e |ndling r|outines.|
|00000f30| 20 41 6e 79 20 70 61 72 | 74 20 6f 66 0d 20 20 20 | Any par|t of. |
|00000f40| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 63 61 6e 20 |the prog|ram can |
|00000f50| 63 68 65 63 6b 20 69 74 | 20 74 6f 20 66 69 6e 64 |check it| to find|
|00000f60| 20 6f 75 74 20 69 66 20 | 69 74 20 69 73 20 63 75 | out if |it is cu|
|00000f70| 72 72 65 6e 74 6c 79 20 | 69 6e 20 74 68 65 20 62 |rrently |in the b|
|00000f80| 61 63 6b 67 72 6f 75 6e | 64 2e 20 2a 2f 0d 42 6f |ackgroun|d. */.Bo|
|00000f90| 6f 6c 65 61 6e 09 09 67 | 49 6e 42 61 63 6b 67 72 |olean..g|InBackgr|
|00000fa0| 6f 75 6e 64 3b 09 09 2f | 2a 20 6d 61 69 6e 74 61 |ound;../|* mainta|
|00000fb0| 69 6e 65 64 20 62 79 20 | 49 6e 69 74 69 61 6c 69 |ined by |Initiali|
|00000fc0| 7a 65 20 61 6e 64 20 44 | 6f 45 76 65 6e 74 20 2a |ze and D|oEvent *|
|00000fd0| 2f 0d 0d 0d 2f 2a 20 54 | 68 65 20 66 6f 6c 6c 6f |/.../* T|he follo|
|00000fe0| 77 69 6e 67 20 67 6c 6f | 62 61 6c 73 20 61 72 65 |wing glo|bals are|
|00000ff0| 20 74 68 65 20 73 74 61 | 74 65 20 6f 66 20 74 68 | the sta|te of th|
|00001000| 65 20 77 69 6e 64 6f 77 | 2e 20 49 66 20 77 65 20 |e window|. If we |
|00001010| 73 75 70 70 6f 72 74 65 | 64 20 6d 6f 72 65 20 74 |supporte|d more t|
|00001020| 68 61 6e 0d 20 20 20 6f | 6e 65 20 77 69 6e 64 6f |han. o|ne windo|
|00001030| 77 2c 20 74 68 65 79 20 | 77 6f 75 6c 64 20 62 65 |w, they |would be|
|00001040| 20 61 74 74 61 74 63 68 | 65 64 20 74 6f 20 65 61 | attatch|ed to ea|
|00001050| 63 68 20 64 6f 63 75 6d | 65 6e 74 2c 20 72 61 74 |ch docum|ent, rat|
|00001060| 68 65 72 20 74 68 61 6e | 20 67 6c 6f 62 61 6c 73 |her than| globals|
|00001070| 2e 20 2a 2f 0d 0d 2f 2a | 20 47 53 74 6f 70 70 65 |. */../*| GStoppe|
|00001080| 64 20 74 65 6c 6c 73 20 | 77 68 65 74 68 65 72 20 |d tells |whether |
|00001090| 74 68 65 20 73 74 6f 70 | 20 6c 69 67 68 74 20 69 |the stop| light i|
|000010a0| 73 20 63 75 72 72 65 6e | 74 6c 79 20 6f 6e 20 73 |s curren|tly on s|
|000010b0| 74 6f 70 20 6f 72 20 67 | 6f 2e 20 2a 2f 0d 42 6f |top or g|o. */.Bo|
|000010c0| 6f 6c 65 61 6e 09 09 67 | 53 74 6f 70 70 65 64 3b |olean..g|Stopped;|
|000010d0| 09 09 09 2f 2a 20 6d 61 | 69 6e 74 61 69 6e 65 64 |.../* ma|intained|
|000010e0| 20 62 79 20 49 6e 69 74 | 69 61 6c 69 7a 65 20 61 | by Init|ialize a|
|000010f0| 6e 64 20 53 65 74 4c 69 | 67 68 74 20 2a 2f 0d 0d |nd SetLi|ght */..|
|00001100| 2f 2a 20 47 53 74 6f 70 | 52 65 63 74 20 61 6e 64 |/* GStop|Rect and|
|00001110| 20 67 47 6f 52 65 63 74 | 20 61 72 65 20 74 68 65 | gGoRect| are the|
|00001120| 20 72 65 63 74 61 6e 67 | 6c 65 73 20 6f 66 20 74 | rectang|les of t|
|00001130| 68 65 20 74 77 6f 20 73 | 74 6f 70 20 6c 69 67 68 |he two s|top ligh|
|00001140| 74 73 20 69 6e 20 74 68 | 65 20 77 69 6e 64 6f 77 |ts in th|e window|
|00001150| 2e 20 2a 2f 0d 52 65 63 | 74 09 09 67 53 74 6f 70 |. */.Rec|t..gStop|
|00001160| 52 65 63 74 3b 09 09 09 | 2f 2a 20 73 65 74 20 75 |Rect;...|/* set u|
|00001170| 70 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |p by Ini|tialize |
|00001180| 2a 2f 0d 52 65 63 74 09 | 09 67 47 6f 52 65 63 74 |*/.Rect.|.gGoRect|
|00001190| 3b 09 09 09 2f 2a 20 73 | 65 74 20 75 70 20 62 79 |;.../* s|et up by|
|000011a0| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 2a 2f 0d 0d | Initial|ize */..|
|000011b0| 0d 2f 2a 20 48 65 72 65 | 20 61 72 65 20 64 65 63 |./* Here| are dec|
|000011c0| 6c 61 72 61 74 69 6f 6e | 73 20 66 6f 72 20 61 6c |laration|s for al|
|000011d0| 6c 20 6f 66 20 74 68 65 | 20 43 20 72 6f 75 74 69 |l of the| C routi|
|000011e0| 6e 65 73 2e 20 49 6e 20 | 4d 50 57 20 33 2e 30 20 |nes. In |MPW 3.0 |
|000011f0| 77 65 20 63 61 6e 20 75 | 73 65 0d 20 20 20 61 63 |we can u|se. ac|
|00001200| 74 75 61 6c 20 70 72 6f | 74 6f 74 79 70 65 73 20 |tual pro|totypes |
|00001210| 66 6f 72 20 70 61 72 61 | 6d 65 74 65 72 20 74 79 |for para|meter ty|
|00001220| 70 65 20 63 68 65 63 6b | 69 6e 67 2e 20 2a 2f 0d |pe check|ing. */.|
|00001230| 23 69 66 6e 64 65 66 20 | 4d 50 57 33 0d 09 76 6f |#ifndef |MPW3..vo|
|00001240| 69 64 20 45 76 65 6e 74 | 4c 6f 6f 70 28 29 3b 0d |id Event|Loop();.|
|00001250| 09 76 6f 69 64 20 44 6f | 45 76 65 6e 74 28 20 2f |.void Do|Event( /|
|00001260| 2a 20 45 76 65 6e 74 52 | 65 63 6f 72 64 20 2a 65 |* EventR|ecord *e|
|00001270| 76 65 6e 74 20 2a 2f 20 | 29 3b 0d 09 76 6f 69 64 |vent */ |);..void|
|00001280| 20 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 20 2f | AdjustC|ursor( /|
|00001290| 2a 20 50 6f 69 6e 74 20 | 6d 6f 75 73 65 2c 20 52 |* Point |mouse, R|
|000012a0| 67 6e 48 61 6e 64 6c 65 | 20 72 65 67 69 6f 6e 20 |gnHandle| region |
|000012b0| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 55 70 |*/ );..v|oid DoUp|
|000012c0| 64 61 74 65 28 20 2f 2a | 20 57 69 6e 64 6f 77 50 |date( /*| WindowP|
|000012d0| 74 72 20 77 69 6e 64 6f | 77 20 2a 2f 20 29 3b 0d |tr windo|w */ );.|
|000012e0| 09 76 6f 69 64 20 44 6f | 41 63 74 69 76 61 74 65 |.void Do|Activate|
|000012f0| 28 20 2f 2a 20 57 69 6e | 64 6f 77 50 74 72 20 77 |( /* Win|dowPtr w|
|00001300| 69 6e 64 6f 77 2c 20 42 | 6f 6f 6c 65 61 6e 20 62 |indow, B|oolean b|
|00001310| 65 63 6f 6d 69 6e 67 41 | 63 74 69 76 65 20 2a 2f |ecomingA|ctive */|
|00001320| 20 29 3b 0d 09 76 6f 69 | 64 20 44 6f 43 6f 6e 74 | );..voi|d DoCont|
|00001330| 65 6e 74 43 6c 69 63 6b | 28 20 2f 2a 20 57 69 6e |entClick|( /* Win|
|00001340| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 20 2a 2f |dowPtr w|indow */|
|00001350| 20 29 3b 0d 09 76 6f 69 | 64 20 44 72 61 77 57 69 | );..voi|d DrawWi|
|00001360| 6e 64 6f 77 28 20 2f 2a | 20 57 69 6e 64 6f 77 50 |ndow( /*| WindowP|
|00001370| 74 72 20 77 69 6e 64 6f | 77 20 2a 2f 20 29 3b 0d |tr windo|w */ );.|
|00001380| 09 76 6f 69 64 20 41 64 | 6a 75 73 74 4d 65 6e 75 |.void Ad|justMenu|
|00001390| 73 28 29 3b 0d 09 76 6f | 69 64 20 44 6f 4d 65 6e |s();..vo|id DoMen|
|000013a0| 75 43 6f 6d 6d 61 6e 64 | 28 20 2f 2a 20 6c 6f 6e |uCommand|( /* lon|
|000013b0| 67 20 6d 65 6e 75 52 65 | 73 75 6c 74 20 2a 2f 20 |g menuRe|sult */ |
|000013c0| 29 3b 0d 09 76 6f 69 64 | 20 53 65 74 4c 69 67 68 |);..void| SetLigh|
|000013d0| 74 28 20 2f 2a 20 57 69 | 6e 64 6f 77 50 74 72 20 |t( /* Wi|ndowPtr |
|000013e0| 77 69 6e 64 6f 77 2c 20 | 42 6f 6f 6c 65 61 6e 20 |window, |Boolean |
|000013f0| 6e 65 77 53 74 6f 70 70 | 65 64 20 2a 2f 20 29 3b |newStopp|ed */ );|
|00001400| 0d 09 42 6f 6f 6c 65 61 | 6e 20 44 6f 43 6c 6f 73 |..Boolea|n DoClos|
|00001410| 65 57 69 6e 64 6f 77 28 | 20 2f 2a 20 57 69 6e 64 |eWindow(| /* Wind|
|00001420| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 20 2a 2f 20 |owPtr wi|ndow */ |
|00001430| 29 3b 0d 09 76 6f 69 64 | 20 54 65 72 6d 69 6e 61 |);..void| Termina|
|00001440| 74 65 28 29 3b 0d 09 76 | 6f 69 64 20 49 6e 69 74 |te();..v|oid Init|
|00001450| 69 61 6c 69 7a 65 28 29 | 3b 0d 09 42 6f 6f 6c 65 |ialize()|;..Boole|
|00001460| 61 6e 20 47 6f 47 65 74 | 52 65 63 74 28 20 2f 2a |an GoGet|Rect( /*|
|00001470| 20 73 68 6f 72 74 20 72 | 65 63 74 49 44 2c 20 52 | short r|ectID, R|
|00001480| 65 63 74 20 2a 74 68 65 | 52 65 63 74 20 2a 2f 20 |ect *the|Rect */ |
|00001490| 29 3b 0d 09 76 6f 69 64 | 20 46 6f 72 63 65 45 6e |);..void| ForceEn|
|000014a0| 76 69 72 6f 6e 73 28 29 | 3b 0d 09 42 6f 6f 6c 65 |virons()|;..Boole|
|000014b0| 61 6e 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 20 |an IsApp|Window( |
|000014c0| 2f 2a 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |/* Windo|wPtr win|
|000014d0| 64 6f 77 20 2a 2f 20 29 | 3b 0d 09 42 6f 6f 6c 65 |dow */ )|;..Boole|
|000014e0| 61 6e 20 49 73 44 41 57 | 69 6e 64 6f 77 28 20 2f |an IsDAW|indow( /|
|000014f0| 2a 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |* Window|Ptr wind|
|00001500| 6f 77 20 2a 2f 20 29 3b | 0d 09 42 6f 6f 6c 65 61 |ow */ );|..Boolea|
|00001510| 6e 20 54 72 61 70 41 76 | 61 69 6c 61 62 6c 65 28 |n TrapAv|ailable(|
|00001520| 20 2f 2a 20 73 68 6f 72 | 74 20 74 4e 75 6d 62 65 | /* shor|t tNumbe|
|00001530| 72 2c 20 54 72 61 70 54 | 79 70 65 20 74 54 79 70 |r, TrapT|ype tTyp|
|00001540| 65 20 2a 2f 20 29 3b 0d | 09 76 6f 69 64 20 41 6c |e */ );.|.void Al|
|00001550| 65 72 74 55 73 65 72 28 | 29 3b 0d 23 65 6c 73 65 |ertUser(|);.#else|
|00001560| 0d 09 76 6f 69 64 20 45 | 76 65 6e 74 4c 6f 6f 70 |..void E|ventLoop|
|00001570| 28 20 76 6f 69 64 20 29 | 3b 0d 09 76 6f 69 64 20 |( void )|;..void |
|00001580| 44 6f 45 76 65 6e 74 28 | 20 45 76 65 6e 74 52 65 |DoEvent(| EventRe|
|00001590| 63 6f 72 64 20 2a 65 76 | 65 6e 74 20 29 3b 0d 09 |cord *ev|ent );..|
|000015a0| 76 6f 69 64 20 41 64 6a | 75 73 74 43 75 72 73 6f |void Adj|ustCurso|
|000015b0| 72 28 20 50 6f 69 6e 74 | 20 6d 6f 75 73 65 2c 20 |r( Point| mouse, |
|000015c0| 52 67 6e 48 61 6e 64 6c | 65 20 72 65 67 69 6f 6e |RgnHandl|e region|
|000015d0| 20 29 3b 0d 09 76 6f 69 | 64 20 44 6f 55 70 64 61 | );..voi|d DoUpda|
|000015e0| 74 65 28 20 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |te( Wind|owPtr wi|
|000015f0| 6e 64 6f 77 20 29 3b 0d | 09 76 6f 69 64 20 44 6f |ndow );.|.void Do|
|00001600| 41 63 74 69 76 61 74 65 | 28 20 57 69 6e 64 6f 77 |Activate|( Window|
|00001610| 50 74 72 20 77 69 6e 64 | 6f 77 2c 20 42 6f 6f 6c |Ptr wind|ow, Bool|
|00001620| 65 61 6e 20 62 65 63 6f | 6d 69 6e 67 41 63 74 69 |ean beco|mingActi|
|00001630| 76 65 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 43 6f |ve );..v|oid DoCo|
|00001640| 6e 74 65 6e 74 43 6c 69 | 63 6b 28 20 57 69 6e 64 |ntentCli|ck( Wind|
|00001650| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 20 29 3b 0d |owPtr wi|ndow );.|
|00001660| 09 76 6f 69 64 20 44 72 | 61 77 57 69 6e 64 6f 77 |.void Dr|awWindow|
|00001670| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|00001680| 6f 77 20 29 3b 0d 09 76 | 6f 69 64 20 41 64 6a 75 |ow );..v|oid Adju|
|00001690| 73 74 4d 65 6e 75 73 28 | 20 76 6f 69 64 20 29 3b |stMenus(| void );|
|000016a0| 0d 09 76 6f 69 64 20 44 | 6f 4d 65 6e 75 43 6f 6d |..void D|oMenuCom|
|000016b0| 6d 61 6e 64 28 20 6c 6f | 6e 67 20 6d 65 6e 75 52 |mand( lo|ng menuR|
|000016c0| 65 73 75 6c 74 20 29 3b | 0d 09 76 6f 69 64 20 53 |esult );|..void S|
|000016d0| 65 74 4c 69 67 68 74 28 | 20 57 69 6e 64 6f 77 50 |etLight(| WindowP|
|000016e0| 74 72 20 77 69 6e 64 6f | 77 2c 20 42 6f 6f 6c 65 |tr windo|w, Boole|
|000016f0| 61 6e 20 6e 65 77 53 74 | 6f 70 70 65 64 20 29 3b |an newSt|opped );|
|00001700| 0d 09 42 6f 6f 6c 65 61 | 6e 20 44 6f 43 6c 6f 73 |..Boolea|n DoClos|
|00001710| 65 57 69 6e 64 6f 77 28 | 20 57 69 6e 64 6f 77 50 |eWindow(| WindowP|
|00001720| 74 72 20 77 69 6e 64 6f | 77 20 29 3b 0d 09 76 6f |tr windo|w );..vo|
|00001730| 69 64 20 54 65 72 6d 69 | 6e 61 74 65 28 20 76 6f |id Termi|nate( vo|
|00001740| 69 64 20 29 3b 0d 09 76 | 6f 69 64 20 49 6e 69 74 |id );..v|oid Init|
|00001750| 69 61 6c 69 7a 65 28 20 | 76 6f 69 64 20 29 3b 0d |ialize( |void );.|
|00001760| 09 42 6f 6f 6c 65 61 6e | 20 47 6f 47 65 74 52 65 |.Boolean| GoGetRe|
|00001770| 63 74 28 20 73 68 6f 72 | 74 20 72 65 63 74 49 44 |ct( shor|t rectID|
|00001780| 2c 20 52 65 63 74 20 2a | 74 68 65 52 65 63 74 20 |, Rect *|theRect |
|00001790| 29 3b 0d 09 76 6f 69 64 | 20 46 6f 72 63 65 45 6e |);..void| ForceEn|
|000017a0| 76 69 72 6f 6e 73 28 20 | 76 6f 69 64 20 29 3b 0d |virons( |void );.|
|000017b0| 09 42 6f 6f 6c 65 61 6e | 20 49 73 41 70 70 57 69 |.Boolean| IsAppWi|
|000017c0| 6e 64 6f 77 28 20 57 69 | 6e 64 6f 77 50 74 72 20 |ndow( Wi|ndowPtr |
|000017d0| 77 69 6e 64 6f 77 20 29 | 3b 0d 09 42 6f 6f 6c 65 |window )|;..Boole|
|000017e0| 61 6e 20 49 73 44 41 57 | 69 6e 64 6f 77 28 20 57 |an IsDAW|indow( W|
|000017f0| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|00001800| 29 3b 0d 09 42 6f 6f 6c | 65 61 6e 20 54 72 61 70 |);..Bool|ean Trap|
|00001810| 41 76 61 69 6c 61 62 6c | 65 28 20 73 68 6f 72 74 |Availabl|e( short|
|00001820| 20 74 4e 75 6d 62 65 72 | 2c 20 54 72 61 70 54 79 | tNumber|, TrapTy|
|00001830| 70 65 20 74 54 79 70 65 | 20 29 3b 0d 09 76 6f 69 |pe tType| );..voi|
|00001840| 64 20 41 6c 65 72 74 55 | 73 65 72 28 20 76 6f 69 |d AlertU|ser( voi|
|00001850| 64 20 29 3b 0d 23 65 6e | 64 69 66 0d 0d 0d 2f 2a |d );.#en|dif.../*|
|00001860| 20 4d 61 6b 65 20 74 68 | 65 20 32 2e 30 20 49 6e | Make th|e 2.0 In|
|00001870| 74 65 72 66 61 63 65 20 | 66 6f 72 20 70 61 73 73 |terface |for pass|
|00001880| 69 6e 67 20 50 6f 69 6e | 74 73 20 74 6f 20 74 68 |ing Poin|ts to th|
|00001890| 65 20 54 6f 6f 6c 62 6f | 78 20 62 79 20 61 64 64 |e Toolbo|x by add|
|000018a0| 72 65 73 73 2c 0d 20 20 | 20 65 6d 75 6c 61 74 65 |ress,. | emulate|
|000018b0| 20 74 68 65 20 33 2e 30 | 20 6d 65 74 68 6f 64 20 | the 3.0| method |
|000018c0| 6f 66 20 70 61 73 73 69 | 6e 67 20 50 6f 69 6e 74 |of passi|ng Point|
|000018d0| 73 20 62 79 20 76 61 6c | 75 65 2e 20 54 68 69 73 |s by val|ue. This|
|000018e0| 20 6c 69 73 74 20 6f 6e | 6c 79 20 63 6f 6e 74 61 | list on|ly conta|
|000018f0| 69 6e 73 0d 20 20 20 74 | 68 65 20 61 66 66 65 63 |ins. t|he affec|
|00001900| 74 65 64 20 72 6f 75 74 | 69 6e 65 73 20 61 63 74 |ted rout|ines act|
|00001910| 75 61 6c 6c 79 20 75 73 | 65 64 20 69 6e 20 74 68 |ually us|ed in th|
|00001920| 69 73 20 73 61 6d 70 6c | 65 2c 20 61 6e 64 20 69 |is sampl|e, and i|
|00001930| 73 20 6e 6f 74 20 69 6e | 74 65 6e 64 65 64 20 74 |s not in|tended t|
|00001940| 6f 0d 20 20 20 62 65 20 | 61 20 63 6f 6d 70 72 65 |o. be |a compre|
|00001950| 68 65 6e 73 69 76 65 20 | 6c 69 73 74 20 6f 66 20 |hensive |list of |
|00001960| 74 68 65 20 61 66 66 65 | 63 74 65 64 20 72 6f 75 |the affe|cted rou|
|00001970| 74 69 6e 65 73 2e 0d 0d | 20 20 20 46 6f 72 20 72 |tines...| For r|
|00001980| 6f 75 74 69 6e 65 73 20 | 74 68 61 74 20 68 61 76 |outines |that hav|
|00001990| 65 20 53 74 72 32 35 35 | 20 66 6f 72 6d 61 6c 20 |e Str255| formal |
|000019a0| 70 61 72 61 6d 65 74 65 | 72 73 20 77 65 20 63 61 |paramete|rs we ca|
|000019b0| 6e 6e 6f 74 20 64 6f 20 | 61 20 73 69 6d 69 6c 61 |nnot do |a simila|
|000019c0| 72 20 74 72 69 63 6b 0d | 20 20 20 73 6f 20 74 68 |r trick.| so th|
|000019d0| 65 20 6e 65 63 65 73 73 | 61 72 79 20 63 68 61 6e |e necess|ary chan|
|000019e0| 67 65 73 20 61 72 65 20 | 69 6e 20 74 68 65 20 63 |ges are |in the c|
|000019f0| 6f 64 65 20 69 74 73 65 | 6c 66 2e 20 53 65 61 72 |ode itse|lf. Sear|
|00001a00| 63 68 69 6e 67 20 66 6f | 72 20 4d 50 57 33 20 77 |ching fo|r MPW3 w|
|00001a10| 69 6c 6c 20 66 69 6e 64 | 0d 20 20 20 74 68 65 6d |ill find|. them|
|00001a20| 2e 20 2a 2f 0d 23 69 66 | 6e 64 65 66 20 4d 50 57 |. */.#if|ndef MPW|
|00001a30| 33 0d 23 09 64 65 66 69 | 6e 65 20 46 69 6e 64 57 |3.#.defi|ne FindW|
|00001a40| 69 6e 64 6f 77 09 46 49 | 4e 44 57 49 4e 44 4f 57 |indow.FI|NDWINDOW|
|00001a50| 0d 23 09 64 65 66 69 6e | 65 20 4d 65 6e 75 53 65 |.#.defin|e MenuSe|
|00001a60| 6c 65 63 74 09 4d 45 4e | 55 53 45 4c 45 43 54 0d |lect.MEN|USELECT.|
|00001a70| 23 09 64 65 66 69 6e 65 | 20 44 72 61 67 57 69 6e |#.define| DragWin|
|00001a80| 64 6f 77 09 44 52 41 47 | 57 49 4e 44 4f 57 0d 23 |dow.DRAG|WINDOW.#|
|00001a90| 09 64 65 66 69 6e 65 20 | 54 72 61 63 6b 42 6f 78 |.define |TrackBox|
|00001aa0| 09 09 54 52 41 43 4b 42 | 4f 58 0d 23 09 64 65 66 |..TRACKB|OX.#.def|
|00001ab0| 69 6e 65 20 50 74 49 6e | 52 67 6e 09 09 50 54 49 |ine PtIn|Rgn..PTI|
|00001ac0| 4e 52 47 4e 0d 23 09 64 | 65 66 69 6e 65 20 44 49 |NRGN.#.d|efine DI|
|00001ad0| 42 61 64 4d 6f 75 6e 74 | 09 44 49 42 41 44 4d 4f |BadMount|.DIBADMO|
|00001ae0| 55 4e 54 0d 70 61 73 63 | 61 6c 20 76 6f 69 64 20 |UNT.pasc|al void |
|00001af0| 44 65 62 75 67 67 65 72 | 28 29 0d 20 20 20 20 65 |Debugger|(). e|
|00001b00| 78 74 65 72 6e 20 30 78 | 41 39 46 46 3b 0d 20 2f |xtern 0x|A9FF;. /|
|00001b10| 2a 20 74 68 65 20 4d 50 | 57 20 32 2e 30 2e 32 20 |* the MP|W 2.0.2 |
|00001b20| 43 49 6e 74 65 72 66 61 | 63 65 73 2e 6f 20 63 6f |CInterfa|ces.o co|
|00001b30| 6e 74 61 69 6e 73 20 62 | 6f 67 75 73 20 67 6c 75 |ntains b|ogus glu|
|00001b40| 65 20 66 6f 72 20 50 75 | 72 67 65 53 70 61 63 65 |e for Pu|rgeSpace|
|00001b50| 2c 20 73 6f 20 77 65 20 | 69 6e 6c 69 6e 65 20 2a |, so we |inline *|
|00001b60| 2f 0d 23 09 64 65 66 69 | 6e 65 20 50 75 72 67 65 |/.#.defi|ne Purge|
|00001b70| 53 70 61 63 65 09 52 65 | 61 6c 50 75 72 67 65 53 |Space.Re|alPurgeS|
|00001b80| 70 61 63 65 0d 70 61 73 | 63 61 6c 20 76 6f 69 64 |pace.pas|cal void|
|00001b90| 20 50 53 31 28 29 20 65 | 78 74 65 72 6e 20 30 78 | PS1() e|xtern 0x|
|00001ba0| 41 31 36 32 3b 0d 70 61 | 73 63 61 6c 20 76 6f 69 |A162;.pa|scal voi|
|00001bb0| 64 20 50 53 32 28 29 20 | 65 78 74 65 72 6e 20 30 |d PS2() |extern 0|
|00001bc0| 78 32 32 36 46 3b 0d 70 | 61 73 63 61 6c 20 76 6f |x226F;.p|ascal vo|
|00001bd0| 69 64 20 50 53 33 28 29 | 20 65 78 74 65 72 6e 20 |id PS3()| extern |
|00001be0| 30 78 30 30 30 34 3b 0d | 70 61 73 63 61 6c 20 76 |0x0004;.|pascal v|
|00001bf0| 6f 69 64 20 50 53 34 28 | 29 20 65 78 74 65 72 6e |oid PS4(|) extern|
|00001c00| 20 30 78 32 32 38 38 3b | 0d 70 61 73 63 61 6c 20 | 0x2288;|.pascal |
|00001c10| 76 6f 69 64 20 50 53 35 | 28 29 20 65 78 74 65 72 |void PS5|() exter|
|00001c20| 6e 20 30 78 32 32 36 46 | 3b 0d 70 61 73 63 61 6c |n 0x226F|;.pascal|
|00001c30| 20 76 6f 69 64 20 50 53 | 36 28 29 20 65 78 74 65 | void PS|6() exte|
|00001c40| 72 6e 20 30 78 30 30 30 | 38 3b 0d 70 61 73 63 61 |rn 0x000|8;.pasca|
|00001c50| 6c 20 76 6f 69 64 20 50 | 53 37 28 29 20 65 78 74 |l void P|S7() ext|
|00001c60| 65 72 6e 20 30 78 32 32 | 38 30 3b 0d 70 61 73 63 |ern 0x22|80;.pasc|
|00001c70| 61 6c 20 76 6f 69 64 20 | 52 65 61 6c 50 75 72 67 |al void |RealPurg|
|00001c80| 65 53 70 61 63 65 20 28 | 6c 6f 6e 67 20 2a 74 6f |eSpace (|long *to|
|00001c90| 74 61 6c 2c 6c 6f 6e 67 | 20 2a 63 6f 6e 74 69 67 |tal,long| *contig|
|00001ca0| 29 0d 09 7b 20 50 53 31 | 28 29 3b 20 50 53 32 28 |)..{ PS1|(); PS2(|
|00001cb0| 29 3b 20 50 53 33 28 29 | 3b 20 50 53 34 28 29 3b |); PS3()|; PS4();|
|00001cc0| 20 50 53 35 28 29 3b 20 | 50 53 36 28 29 3b 20 50 | PS5(); |PS6(); P|
|00001cd0| 53 37 28 29 3b 20 7d 0d | 09 2f 2a 09 5f 50 75 72 |S7(); }.|./*._Pur|
|00001ce0| 67 65 53 70 61 63 65 0d | 09 09 4d 4f 56 45 2e 4c |geSpace.|..MOVE.L|
|00001cf0| 09 24 30 30 30 34 28 41 | 37 29 2c 41 31 0d 09 09 |.$0004(A|7),A1...|
|00001d00| 4d 4f 56 45 2e 4c 09 41 | 30 2c 28 41 31 29 0d 09 |MOVE.L.A|0,(A1)..|
|00001d10| 09 4d 4f 56 45 2e 4c 09 | 24 30 30 30 38 28 41 37 |.MOVE.L.|$0008(A7|
|00001d20| 29 2c 41 31 0d 09 09 4d | 4f 56 45 2e 4c 09 44 30 |),A1...M|OVE.L.D0|
|00001d30| 2c 28 41 31 29 0d 09 2a | 2f 0d 23 65 6e 64 69 66 |,(A1)..*|/.#endif|
|00001d40| 0d 0d 2f 2a 20 44 65 66 | 69 6e 65 20 48 69 57 72 |../* Def|ine HiWr|
|00001d50| 64 20 61 6e 64 20 4c 6f | 57 72 64 20 6d 61 63 72 |d and Lo|Wrd macr|
|00001d60| 6f 73 20 66 6f 72 20 65 | 66 66 69 63 69 65 6e 63 |os for e|fficienc|
|00001d70| 79 2e 20 2a 2f 0d 23 64 | 65 66 69 6e 65 20 48 69 |y. */.#d|efine Hi|
|00001d80| 57 72 64 28 61 4c 6f 6e | 67 29 09 28 28 28 61 4c |Wrd(aLon|g).(((aL|
|00001d90| 6f 6e 67 29 20 3e 3e 20 | 31 36 29 20 26 20 30 78 |ong) >> |16) & 0x|
|00001da0| 46 46 46 46 29 0d 23 64 | 65 66 69 6e 65 20 4c 6f |FFFF).#d|efine Lo|
|00001db0| 57 72 64 28 61 4c 6f 6e | 67 29 09 28 28 61 4c 6f |Wrd(aLon|g).((aLo|
|00001dc0| 6e 67 29 20 26 20 30 78 | 46 46 46 46 29 0d 0d 2f |ng) & 0x|FFFF)../|
|00001dd0| 2a 20 44 65 66 69 6e 65 | 20 54 6f 70 4c 65 66 74 |* Define| TopLeft|
|00001de0| 20 61 6e 64 20 42 6f 74 | 52 69 67 68 74 20 6d 61 | and Bot|Right ma|
|00001df0| 63 72 6f 73 20 66 6f 72 | 20 63 6f 6e 76 65 6e 69 |cros for| conveni|
|00001e00| 65 6e 63 65 2e 20 4e 6f | 74 69 63 65 20 74 68 65 |ence. No|tice the|
|00001e10| 20 69 6d 70 6c 69 63 69 | 74 0d 20 20 20 64 65 70 | implici|t. dep|
|00001e20| 65 6e 64 65 6e 63 79 20 | 6f 6e 20 74 68 65 20 6f |endency |on the o|
|00001e30| 72 64 65 72 69 6e 67 20 | 6f 66 20 66 69 65 6c 64 |rdering |of field|
|00001e40| 73 20 77 69 74 68 69 6e | 20 61 20 52 65 63 74 20 |s within| a Rect |
|00001e50| 2a 2f 0d 23 64 65 66 69 | 6e 65 20 54 6f 70 4c 65 |*/.#defi|ne TopLe|
|00001e60| 66 74 28 61 52 65 63 74 | 29 09 28 2a 20 28 50 6f |ft(aRect|).(* (Po|
|00001e70| 69 6e 74 20 2a 29 20 26 | 28 61 52 65 63 74 29 2e |int *) &|(aRect).|
|00001e80| 74 6f 70 29 0d 23 64 65 | 66 69 6e 65 20 42 6f 74 |top).#de|fine Bot|
|00001e90| 52 69 67 68 74 28 61 52 | 65 63 74 29 09 28 2a 20 |Right(aR|ect).(* |
|00001ea0| 28 50 6f 69 6e 74 20 2a | 29 20 26 28 61 52 65 63 |(Point *|) &(aRec|
|00001eb0| 74 29 2e 62 6f 74 74 6f | 6d 29 0d 0d 0d 65 78 74 |t).botto|m)...ext|
|00001ec0| 65 72 6e 20 76 6f 69 64 | 20 5f 44 61 74 61 49 6e |ern void| _DataIn|
|00001ed0| 69 74 28 29 3b 0d 0d 2f | 2a 20 54 68 69 73 20 72 |it();../|* This r|
|00001ee0| 6f 75 74 69 6e 65 20 69 | 73 20 70 61 72 74 20 6f |outine i|s part o|
|00001ef0| 66 20 74 68 65 20 4d 50 | 57 20 72 75 6e 74 69 6d |f the MP|W runtim|
|00001f00| 65 20 6c 69 62 72 61 72 | 79 2e 20 54 68 69 73 20 |e librar|y. This |
|00001f10| 65 78 74 65 72 6e 61 6c | 0d 20 20 20 72 65 66 65 |external|. refe|
|00001f20| 72 65 6e 63 65 20 74 6f | 20 69 74 20 69 73 20 64 |rence to| it is d|
|00001f30| 6f 6e 65 20 73 6f 20 74 | 68 61 74 20 77 65 20 63 |one so t|hat we c|
|00001f40| 61 6e 20 75 6e 6c 6f 61 | 64 20 69 74 73 20 73 65 |an unloa|d its se|
|00001f50| 67 6d 65 6e 74 2c 20 25 | 41 35 49 6e 69 74 2e 20 |gment, %|A5Init. |
|00001f60| 2a 2f 0d 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 |*/...#de|fine __S|
|00001f70| 45 47 5f 5f 20 4d 61 69 | 6e 0d 6d 61 69 6e 28 29 |EG__ Mai|n.main()|
|00001f80| 0d 7b 0d 09 55 6e 6c 6f | 61 64 53 65 67 28 28 50 |.{..Unlo|adSeg((P|
|00001f90| 74 72 29 20 5f 44 61 74 | 61 49 6e 69 74 29 3b 09 |tr) _Dat|aInit);.|
|00001fa0| 09 2f 2a 20 6e 6f 74 65 | 20 74 68 61 74 20 5f 44 |./* note| that _D|
|00001fb0| 61 74 61 49 6e 69 74 20 | 6d 75 73 74 20 6e 6f 74 |ataInit |must not|
|00001fc0| 20 62 65 20 69 6e 20 4d | 61 69 6e 21 20 2a 2f 0d | be in M|ain! */.|
|00001fd0| 09 0d 09 2f 2a 20 31 2e | 30 31 20 2d 20 63 61 6c |.../* 1.|01 - cal|
|00001fe0| 6c 20 74 6f 20 46 6f 72 | 63 65 45 6e 76 69 72 6f |l to For|ceEnviro|
|00001ff0| 6e 73 20 72 65 6d 6f 76 | 65 64 20 2a 2f 0d 09 0d |ns remov|ed */...|
|00002000| 09 2f 2a 09 49 66 20 79 | 6f 75 20 68 61 76 65 20 |./*.If y|ou have |
|00002010| 73 74 61 63 6b 20 72 65 | 71 75 69 72 65 6d 65 6e |stack re|quiremen|
|00002020| 74 73 20 74 68 61 74 20 | 64 69 66 66 65 72 20 66 |ts that |differ f|
|00002030| 72 6f 6d 20 74 68 65 20 | 64 65 66 61 75 6c 74 2c |rom the |default,|
|00002040| 0d 09 09 74 68 65 6e 20 | 79 6f 75 20 63 6f 75 6c |...then |you coul|
|00002050| 64 20 75 73 65 20 53 65 | 74 41 70 70 6c 4c 69 6d |d use Se|tApplLim|
|00002060| 69 74 20 74 6f 20 69 6e | 63 72 65 61 73 65 20 53 |it to in|crease S|
|00002070| 74 61 63 6b 53 70 61 63 | 65 20 61 74 20 0d 09 09 |tackSpac|e at ...|
|00002080| 74 68 69 73 20 70 6f 69 | 6e 74 2c 20 62 65 66 6f |this poi|nt, befo|
|00002090| 72 65 20 63 61 6c 6c 69 | 6e 67 20 4d 61 78 41 70 |re calli|ng MaxAp|
|000020a0| 70 6c 5a 6f 6e 65 2e 20 | 2a 2f 0d 09 4d 61 78 41 |plZone. |*/..MaxA|
|000020b0| 70 70 6c 5a 6f 6e 65 28 | 29 3b 09 09 09 09 09 2f |pplZone(|);...../|
|000020c0| 2a 20 65 78 70 61 6e 64 | 20 74 68 65 20 68 65 61 |* expand| the hea|
|000020d0| 70 20 73 6f 20 63 6f 64 | 65 20 73 65 67 6d 65 6e |p so cod|e segmen|
|000020e0| 74 73 20 6c 6f 61 64 20 | 61 74 20 74 68 65 20 74 |ts load |at the t|
|000020f0| 6f 70 20 2a 2f 0d 0d 09 | 49 6e 69 74 69 61 6c 69 |op */...|Initiali|
|00002100| 7a 65 28 29 3b 09 09 09 | 09 09 2f 2a 20 69 6e 69 |ze();...|../* ini|
|00002110| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 70 72 6f 67 |tialize |the prog|
|00002120| 72 61 6d 20 2a 2f 0d 09 | 55 6e 6c 6f 61 64 53 65 |ram */..|UnloadSe|
|00002130| 67 28 28 50 74 72 29 20 | 49 6e 69 74 69 61 6c 69 |g((Ptr) |Initiali|
|00002140| 7a 65 29 3b 09 2f 2a 20 | 6e 6f 74 65 20 74 68 61 |ze);./* |note tha|
|00002150| 74 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 6d 75 73 |t Initia|lize mus|
|00002160| 74 20 6e 6f 74 20 62 65 | 20 69 6e 20 4d 61 69 6e |t not be| in Main|
|00002170| 21 20 2a 2f 0d 0d 09 45 | 76 65 6e 74 4c 6f 6f 70 |! */...E|ventLoop|
|00002180| 28 29 3b 09 09 09 09 09 | 2f 2a 20 63 61 6c 6c 20 |();.....|/* call |
|00002190| 74 68 65 20 6d 61 69 6e | 20 65 76 65 6e 74 20 6c |the main| event l|
|000021a0| 6f 6f 70 20 2a 2f 0d 7d | 0d 0d 0d 2f 2a 09 47 65 |oop */.}|.../*.Ge|
|000021b0| 74 20 65 76 65 6e 74 73 | 20 66 6f 72 65 76 65 72 |t events| forever|
|000021c0| 2c 20 61 6e 64 20 68 61 | 6e 64 6c 65 20 74 68 65 |, and ha|ndle the|
|000021d0| 6d 20 62 79 20 63 61 6c | 6c 69 6e 67 20 44 6f 45 |m by cal|ling DoE|
|000021e0| 76 65 6e 74 2e 0d 09 47 | 65 74 20 74 68 65 20 65 |vent...G|et the e|
|000021f0| 76 65 6e 74 73 20 62 79 | 20 63 61 6c 6c 69 6e 67 |vents by| calling|
|00002200| 20 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 2c 20 | WaitNex|tEvent, |
|00002210| 69 66 20 69 74 27 73 20 | 61 76 61 69 6c 61 62 6c |if it's |availabl|
|00002220| 65 2c 20 6f 74 68 65 72 | 77 69 73 65 0d 09 62 79 |e, other|wise..by|
|00002230| 20 63 61 6c 6c 69 6e 67 | 20 47 65 74 4e 65 78 74 | calling| GetNext|
|00002240| 45 76 65 6e 74 2e 20 41 | 6c 73 6f 20 63 61 6c 6c |Event. A|lso call|
|00002250| 20 41 64 6a 75 73 74 43 | 75 72 73 6f 72 20 65 61 | AdjustC|ursor ea|
|00002260| 63 68 20 74 69 6d 65 20 | 74 68 72 6f 75 67 68 20 |ch time |through |
|00002270| 74 68 65 20 6c 6f 6f 70 | 2e 20 2a 2f 0d 0d 23 64 |the loop|. */..#d|
|00002280| 65 66 69 6e 65 20 5f 5f | 53 45 47 5f 5f 20 4d 61 |efine __|SEG__ Ma|
|00002290| 69 6e 0d 76 6f 69 64 20 | 45 76 65 6e 74 4c 6f 6f |in.void |EventLoo|
|000022a0| 70 28 29 0d 7b 0d 09 52 | 67 6e 48 61 6e 64 6c 65 |p().{..R|gnHandle|
|000022b0| 09 63 75 72 73 6f 72 52 | 67 6e 3b 0d 09 42 6f 6f |.cursorR|gn;..Boo|
|000022c0| 6c 65 61 6e 09 09 67 6f | 74 45 76 65 6e 74 3b 0d |lean..go|tEvent;.|
|000022d0| 09 45 76 65 6e 74 52 65 | 63 6f 72 64 09 65 76 65 |.EventRe|cord.eve|
|000022e0| 6e 74 3b 0d 0d 09 63 75 | 72 73 6f 72 52 67 6e 20 |nt;...cu|rsorRgn |
|000022f0| 3d 20 4e 65 77 52 67 6e | 28 29 3b 09 09 09 2f 2a |= NewRgn|();.../*|
|00002300| 20 77 65 d5 6c 6c 20 70 | 61 73 73 20 57 4e 45 20 | we.ll p|ass WNE |
|00002310| 61 6e 20 65 6d 70 74 79 | 20 72 65 67 69 6f 6e 20 |an empty| region |
|00002320| 74 68 65 20 31 73 74 20 | 74 69 6d 65 20 74 68 72 |the 1st |time thr|
|00002330| 75 20 2a 2f 0d 09 64 6f | 20 7b 0d 09 09 2f 2a 20 |u */..do| {.../* |
|00002340| 75 73 65 20 57 4e 45 20 | 69 66 20 69 74 20 69 73 |use WNE |if it is|
|00002350| 20 61 76 61 69 6c 61 62 | 6c 65 20 2a 2f 0d 09 09 | availab|le */...|
|00002360| 69 66 20 28 20 67 48 61 | 73 57 61 69 74 4e 65 78 |if ( gHa|sWaitNex|
|00002370| 74 45 76 65 6e 74 20 29 | 0d 09 09 09 67 6f 74 45 |tEvent )|....gotE|
|00002380| 76 65 6e 74 20 3d 20 57 | 61 69 74 4e 65 78 74 45 |vent = W|aitNextE|
|00002390| 76 65 6e 74 28 65 76 65 | 72 79 45 76 65 6e 74 2c |vent(eve|ryEvent,|
|000023a0| 20 26 65 76 65 6e 74 2c | 20 4d 41 58 4c 4f 4e 47 | &event,| MAXLONG|
|000023b0| 2c 20 63 75 72 73 6f 72 | 52 67 6e 29 3b 0d 09 09 |, cursor|Rgn);...|
|000023c0| 65 6c 73 65 20 7b 0d 09 | 09 09 53 79 73 74 65 6d |else {..|..System|
|000023d0| 54 61 73 6b 28 29 3b 0d | 09 09 09 67 6f 74 45 76 |Task();.|...gotEv|
|000023e0| 65 6e 74 20 3d 20 47 65 | 74 4e 65 78 74 45 76 65 |ent = Ge|tNextEve|
|000023f0| 6e 74 28 65 76 65 72 79 | 45 76 65 6e 74 2c 20 26 |nt(every|Event, &|
|00002400| 65 76 65 6e 74 29 3b 0d | 09 09 7d 0d 09 09 69 66 |event);.|..}...if|
|00002410| 20 28 20 67 6f 74 45 76 | 65 6e 74 20 29 20 7b 0d | ( gotEv|ent ) {.|
|00002420| 09 09 09 2f 2a 20 6d 61 | 6b 65 20 73 75 72 65 20 |.../* ma|ke sure |
|00002430| 77 65 20 68 61 76 65 20 | 74 68 65 20 72 69 67 68 |we have |the righ|
|00002440| 74 20 63 75 72 73 6f 72 | 20 62 65 66 6f 72 65 20 |t cursor| before |
|00002450| 68 61 6e 64 6c 69 6e 67 | 20 74 68 65 20 65 76 65 |handling| the eve|
|00002460| 6e 74 20 2a 2f 0d 09 09 | 09 41 64 6a 75 73 74 43 |nt */...|.AdjustC|
|00002470| 75 72 73 6f 72 28 65 76 | 65 6e 74 2e 77 68 65 72 |ursor(ev|ent.wher|
|00002480| 65 2c 20 63 75 72 73 6f | 72 52 67 6e 29 3b 0d 09 |e, curso|rRgn);..|
|00002490| 09 09 44 6f 45 76 65 6e | 74 28 26 65 76 65 6e 74 |..DoEven|t(&event|
|000024a0| 29 3b 0d 09 09 7d 0d 09 | 09 2f 2a 20 63 68 61 6e |);...}..|./* chan|
|000024b0| 67 65 20 74 68 65 20 63 | 75 72 73 6f 72 20 28 61 |ge the c|ursor (a|
|000024c0| 6e 64 20 72 65 67 69 6f | 6e 29 20 69 66 20 6e 65 |nd regio|n) if ne|
|000024d0| 63 65 73 73 61 72 79 20 | 2a 2f 0d 09 09 41 64 6a |cessary |*/...Adj|
|000024e0| 75 73 74 43 75 72 73 6f | 72 28 65 76 65 6e 74 2e |ustCurso|r(event.|
|000024f0| 77 68 65 72 65 2c 20 63 | 75 72 73 6f 72 52 67 6e |where, c|ursorRgn|
|00002500| 29 3b 0d 09 7d 20 77 68 | 69 6c 65 20 28 20 74 72 |);..} wh|ile ( tr|
|00002510| 75 65 20 29 3b 09 2f 2a | 20 6c 6f 6f 70 20 66 6f |ue );./*| loop fo|
|00002520| 72 65 76 65 72 3b 20 77 | 65 20 71 75 69 74 20 76 |rever; w|e quit v|
|00002530| 69 61 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 20 2a |ia ExitT|oShell *|
|00002540| 2f 0d 7d 20 2f 2a 45 76 | 65 6e 74 4c 6f 6f 70 2a |/.} /*Ev|entLoop*|
|00002550| 2f 0d 0d 0d 2f 2a 20 44 | 6f 20 74 68 65 20 72 69 |/.../* D|o the ri|
|00002560| 67 68 74 20 74 68 69 6e | 67 20 66 6f 72 20 61 6e |ght thin|g for an|
|00002570| 20 65 76 65 6e 74 2e 20 | 44 65 74 65 72 6d 69 6e | event. |Determin|
|00002580| 65 20 77 68 61 74 20 6b | 69 6e 64 20 6f 66 20 65 |e what k|ind of e|
|00002590| 76 65 6e 74 20 69 74 20 | 69 73 2c 20 61 6e 64 20 |vent it |is, and |
|000025a0| 63 61 6c 6c 0d 20 74 68 | 65 20 61 70 70 72 6f 70 |call. th|e approp|
|000025b0| 72 69 61 74 65 20 72 6f | 75 74 69 6e 65 73 2e 20 |riate ro|utines. |
|000025c0| 2a 2f 0d 0d 23 64 65 66 | 69 6e 65 20 5f 5f 53 45 |*/..#def|ine __SE|
|000025d0| 47 5f 5f 20 4d 61 69 6e | 0d 76 6f 69 64 20 44 6f |G__ Main|.void Do|
|000025e0| 45 76 65 6e 74 28 65 76 | 65 6e 74 29 0d 09 45 76 |Event(ev|ent)..Ev|
|000025f0| 65 6e 74 52 65 63 6f 72 | 64 09 2a 65 76 65 6e 74 |entRecor|d.*event|
|00002600| 3b 0d 7b 0d 09 73 68 6f | 72 74 09 09 70 61 72 74 |;.{..sho|rt..part|
|00002610| 2c 20 65 72 72 3b 0d 09 | 57 69 6e 64 6f 77 50 74 |, err;..|WindowPt|
|00002620| 72 09 77 69 6e 64 6f 77 | 3b 0d 09 42 6f 6f 6c 65 |r.window|;..Boole|
|00002630| 61 6e 09 09 68 69 74 3b | 0d 09 63 68 61 72 09 09 |an..hit;|..char..|
|00002640| 6b 65 79 3b 0d 09 50 6f | 69 6e 74 09 09 61 50 6f |key;..Po|int..aPo|
|00002650| 69 6e 74 3b 0d 0d 09 73 | 77 69 74 63 68 20 28 20 |int;...s|witch ( |
|00002660| 65 76 65 6e 74 2d 3e 77 | 68 61 74 20 29 20 7b 0d |event->w|hat ) {.|
|00002670| 09 09 63 61 73 65 20 6d | 6f 75 73 65 44 6f 77 6e |..case m|ouseDown|
|00002680| 3a 0d 09 09 09 70 61 72 | 74 20 3d 20 46 69 6e 64 |:....par|t = Find|
|00002690| 57 69 6e 64 6f 77 28 65 | 76 65 6e 74 2d 3e 77 68 |Window(e|vent->wh|
|000026a0| 65 72 65 2c 20 26 77 69 | 6e 64 6f 77 29 3b 0d 09 |ere, &wi|ndow);..|
|000026b0| 09 09 73 77 69 74 63 68 | 20 28 20 70 61 72 74 20 |..switch| ( part |
|000026c0| 29 20 7b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 4d |) {.....|case inM|
|000026d0| 65 6e 75 42 61 72 3a 09 | 09 09 09 2f 2a 20 70 72 |enuBar:.|.../* pr|
|000026e0| 6f 63 65 73 73 20 61 20 | 6d 6f 75 73 65 20 6d 65 |ocess a |mouse me|
|000026f0| 6e 75 20 63 6f 6d 6d 61 | 6e 64 20 28 69 66 20 61 |nu comma|nd (if a|
|00002700| 6e 79 29 20 2a 2f 0d 09 | 09 09 09 09 41 64 6a 75 |ny) */..|....Adju|
|00002710| 73 74 4d 65 6e 75 73 28 | 29 3b 0d 09 09 09 09 09 |stMenus(|);......|
|00002720| 44 6f 4d 65 6e 75 43 6f | 6d 6d 61 6e 64 28 4d 65 |DoMenuCo|mmand(Me|
|00002730| 6e 75 53 65 6c 65 63 74 | 28 65 76 65 6e 74 2d 3e |nuSelect|(event->|
|00002740| 77 68 65 72 65 29 29 3b | 0d 09 09 09 09 09 62 72 |where));|......br|
|00002750| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 6e |eak;....|.case in|
|00002760| 53 79 73 57 69 6e 64 6f | 77 3a 09 09 09 2f 2a 20 |SysWindo|w:.../* |
|00002770| 6c 65 74 20 74 68 65 20 | 73 79 73 74 65 6d 20 68 |let the |system h|
|00002780| 61 6e 64 6c 65 20 74 68 | 65 20 6d 6f 75 73 65 44 |andle th|e mouseD|
|00002790| 6f 77 6e 20 2a 2f 0d 09 | 09 09 09 09 53 79 73 74 |own */..|....Syst|
|000027a0| 65 6d 43 6c 69 63 6b 28 | 65 76 65 6e 74 2c 20 77 |emClick(|event, w|
|000027b0| 69 6e 64 6f 77 29 3b 0d | 09 09 09 09 09 62 72 65 |indow);.|.....bre|
|000027c0| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 43 |ak;.....|case inC|
|000027d0| 6f 6e 74 65 6e 74 3a 0d | 09 09 09 09 09 69 66 20 |ontent:.|.....if |
|000027e0| 28 20 77 69 6e 64 6f 77 | 20 21 3d 20 46 72 6f 6e |( window| != Fron|
|000027f0| 74 57 69 6e 64 6f 77 28 | 29 20 29 20 7b 0d 09 09 |tWindow(|) ) {...|
|00002800| 09 09 09 09 53 65 6c 65 | 63 74 57 69 6e 64 6f 77 |....Sele|ctWindow|
|00002810| 28 77 69 6e 64 6f 77 29 | 3b 0d 09 09 09 09 09 09 |(window)|;.......|
|00002820| 2f 2a 44 6f 45 76 65 6e | 74 28 65 76 65 6e 74 29 |/*DoEven|t(event)|
|00002830| 3b 2a 2f 09 2f 2a 20 75 | 73 65 20 74 68 69 73 20 |;*/./* u|se this |
|00002840| 6c 69 6e 65 20 66 6f 72 | 20 22 64 6f 20 66 69 72 |line for| "do fir|
|00002850| 73 74 20 63 6c 69 63 6b | 22 20 2a 2f 0d 09 09 09 |st click|" */....|
|00002860| 09 09 7d 20 65 6c 73 65 | 0d 09 09 09 09 09 09 44 |..} else|.......D|
|00002870| 6f 43 6f 6e 74 65 6e 74 | 43 6c 69 63 6b 28 77 69 |oContent|Click(wi|
|00002880| 6e 64 6f 77 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |ndow);..|....brea|
|00002890| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 44 72 |k;.....c|ase inDr|
|000028a0| 61 67 3a 09 09 09 09 2f | 2a 20 70 61 73 73 20 73 |ag:..../|* pass s|
|000028b0| 63 72 65 65 6e 42 69 74 | 73 2e 62 6f 75 6e 64 73 |creenBit|s.bounds|
|000028c0| 20 74 6f 20 67 65 74 20 | 61 6c 6c 20 67 44 65 76 | to get |all gDev|
|000028d0| 69 63 65 73 20 2a 2f 0d | 09 09 09 09 09 44 72 61 |ices */.|.....Dra|
|000028e0| 67 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 2c 20 |gWindow(|window, |
|000028f0| 65 76 65 6e 74 2d 3e 77 | 68 65 72 65 2c 20 26 71 |event->w|here, &q|
|00002900| 64 2e 73 63 72 65 65 6e | 42 69 74 73 2e 62 6f 75 |d.screen|Bits.bou|
|00002910| 6e 64 73 29 3b 0d 09 09 | 09 09 09 62 72 65 61 6b |nds);...|...break|
|00002920| 3b 0d 09 09 09 09 63 61 | 73 65 20 69 6e 47 72 6f |;.....ca|se inGro|
|00002930| 77 3a 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |w:......|break;..|
|00002940| 09 09 09 63 61 73 65 20 | 69 6e 5a 6f 6f 6d 49 6e |...case |inZoomIn|
|00002950| 3a 0d 09 09 09 09 63 61 | 73 65 20 69 6e 5a 6f 6f |:.....ca|se inZoo|
|00002960| 6d 4f 75 74 3a 0d 09 09 | 09 09 09 68 69 74 20 3d |mOut:...|...hit =|
|00002970| 20 54 72 61 63 6b 42 6f | 78 28 77 69 6e 64 6f 77 | TrackBo|x(window|
|00002980| 2c 20 65 76 65 6e 74 2d | 3e 77 68 65 72 65 2c 20 |, event-|>where, |
|00002990| 70 61 72 74 29 3b 0d 09 | 09 09 09 09 69 66 20 28 |part);..|....if (|
|000029a0| 20 68 69 74 20 29 20 7b | 0d 09 09 09 09 09 09 53 | hit ) {|.......S|
|000029b0| 65 74 50 6f 72 74 28 77 | 69 6e 64 6f 77 29 3b 09 |etPort(w|indow);.|
|000029c0| 09 09 09 2f 2a 20 74 68 | 65 20 77 69 6e 64 6f 77 |.../* th|e window|
|000029d0| 20 6d 75 73 74 20 62 65 | 20 74 68 65 20 63 75 72 | must be| the cur|
|000029e0| 72 65 6e 74 20 70 6f 72 | 74 2e 2e 2e 20 2a 2f 0d |rent por|t... */.|
|000029f0| 09 09 09 09 09 09 45 72 | 61 73 65 52 65 63 74 28 |......Er|aseRect(|
|00002a00| 26 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 |&window-|>portRec|
|00002a10| 74 29 3b 09 2f 2a 20 62 | 65 63 61 75 73 65 20 6f |t);./* b|ecause o|
|00002a20| 66 20 61 20 62 75 67 20 | 69 6e 20 5a 6f 6f 6d 57 |f a bug |in ZoomW|
|00002a30| 69 6e 64 6f 77 20 2a 2f | 0d 09 09 09 09 09 09 5a |indow */|.......Z|
|00002a40| 6f 6f 6d 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oomWindo|w(window|
|00002a50| 2c 20 70 61 72 74 2c 20 | 74 72 75 65 29 3b 09 2f |, part, |true);./|
|00002a60| 2a 20 6e 6f 74 65 20 74 | 68 61 74 20 77 65 20 69 |* note t|hat we i|
|00002a70| 6e 76 61 6c 69 64 61 74 | 65 20 61 6e 64 20 65 72 |nvalidat|e and er|
|00002a80| 61 73 65 2e 2e 2e 20 2a | 2f 0d 09 09 09 09 09 09 |ase... *|/.......|
|00002a90| 49 6e 76 61 6c 52 65 63 | 74 28 26 77 69 6e 64 6f |InvalRec|t(&windo|
|00002aa0| 77 2d 3e 70 6f 72 74 52 | 65 63 74 29 3b 09 2f 2a |w->portR|ect);./*|
|00002ab0| 20 74 6f 20 6d 61 6b 65 | 20 74 68 69 6e 67 73 20 | to make| things |
|00002ac0| 6c 6f 6f 6b 20 62 65 74 | 74 65 72 20 6f 6e 2d 73 |look bet|ter on-s|
|00002ad0| 63 72 65 65 6e 20 2a 2f | 0d 09 09 09 09 09 7d 0d |creen */|......}.|
|00002ae0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 7d |.....bre|ak;....}|
|00002af0| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 63 61 73 |....brea|k;...cas|
|00002b00| 65 20 6b 65 79 44 6f 77 | 6e 3a 0d 09 09 63 61 73 |e keyDow|n:...cas|
|00002b10| 65 20 61 75 74 6f 4b 65 | 79 3a 09 09 09 09 09 09 |e autoKe|y:......|
|00002b20| 2f 2a 20 63 68 65 63 6b | 20 66 6f 72 20 6d 65 6e |/* check| for men|
|00002b30| 75 6b 65 79 20 65 71 75 | 69 76 61 6c 65 6e 74 73 |ukey equ|ivalents|
|00002b40| 20 2a 2f 0d 09 09 09 6b | 65 79 20 3d 20 65 76 65 | */....k|ey = eve|
|00002b50| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 20 26 20 63 68 |nt->mess|age & ch|
|00002b60| 61 72 43 6f 64 65 4d 61 | 73 6b 3b 0d 09 09 09 69 |arCodeMa|sk;....i|
|00002b70| 66 20 28 20 65 76 65 6e | 74 2d 3e 6d 6f 64 69 66 |f ( even|t->modif|
|00002b80| 69 65 72 73 20 26 20 63 | 6d 64 4b 65 79 20 29 09 |iers & c|mdKey ).|
|00002b90| 09 09 2f 2a 20 43 6f 6d | 6d 61 6e 64 20 6b 65 79 |../* Com|mand key|
|00002ba0| 20 64 6f 77 6e 20 2a 2f | 0d 09 09 09 09 69 66 20 | down */|.....if |
|00002bb0| 28 20 65 76 65 6e 74 2d | 3e 77 68 61 74 20 3d 3d |( event-|>what ==|
|00002bc0| 20 6b 65 79 44 6f 77 6e | 20 29 20 7b 0d 09 09 09 | keyDown| ) {....|
|00002bd0| 09 09 41 64 6a 75 73 74 | 4d 65 6e 75 73 28 29 3b |..Adjust|Menus();|
|00002be0| 09 09 09 09 09 09 2f 2a | 20 65 6e 61 62 6c 65 2f |....../*| enable/|
|00002bf0| 64 69 73 61 62 6c 65 2f | 63 68 65 63 6b 20 6d 65 |disable/|check me|
|00002c00| 6e 75 20 69 74 65 6d 73 | 20 70 72 6f 70 65 72 6c |nu items| properl|
|00002c10| 79 20 2a 2f 0d 09 09 09 | 09 09 44 6f 4d 65 6e 75 |y */....|..DoMenu|
|00002c20| 43 6f 6d 6d 61 6e 64 28 | 4d 65 6e 75 4b 65 79 28 |Command(|MenuKey(|
|00002c30| 6b 65 79 29 29 3b 0d 09 | 09 09 09 7d 0d 09 09 09 |key));..|...}....|
|00002c40| 62 72 65 61 6b 3b 0d 09 | 09 63 61 73 65 20 61 63 |break;..|.case ac|
|00002c50| 74 69 76 61 74 65 45 76 | 74 3a 0d 09 09 09 44 6f |tivateEv|t:....Do|
|00002c60| 41 63 74 69 76 61 74 65 | 28 28 57 69 6e 64 6f 77 |Activate|((Window|
|00002c70| 50 74 72 29 20 65 76 65 | 6e 74 2d 3e 6d 65 73 73 |Ptr) eve|nt->mess|
|00002c80| 61 67 65 2c 20 28 65 76 | 65 6e 74 2d 3e 6d 6f 64 |age, (ev|ent->mod|
|00002c90| 69 66 69 65 72 73 20 26 | 20 61 63 74 69 76 65 46 |ifiers &| activeF|
|00002ca0| 6c 61 67 29 20 21 3d 20 | 30 29 3b 0d 09 09 09 62 |lag) != |0);....b|
|00002cb0| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 75 70 64 |reak;...|case upd|
|00002cc0| 61 74 65 45 76 74 3a 0d | 09 09 09 44 6f 55 70 64 |ateEvt:.|...DoUpd|
|00002cd0| 61 74 65 28 28 57 69 6e | 64 6f 77 50 74 72 29 20 |ate((Win|dowPtr) |
|00002ce0| 65 76 65 6e 74 2d 3e 6d | 65 73 73 61 67 65 29 3b |event->m|essage);|
|00002cf0| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 2f 2a 09 |....brea|k;.../*.|
|00002d00| 31 2e 30 31 20 2d 20 49 | 74 20 69 73 20 6e 6f 74 |1.01 - I|t is not|
|00002d10| 20 61 20 62 61 64 20 69 | 64 65 61 20 74 6f 20 61 | a bad i|dea to a|
|00002d20| 74 20 6c 65 61 73 74 20 | 63 61 6c 6c 20 44 49 42 |t least |call DIB|
|00002d30| 61 64 4d 6f 75 6e 74 20 | 69 6e 20 72 65 73 70 6f |adMount |in respo|
|00002d40| 6e 73 65 0d 09 09 09 74 | 6f 20 61 20 64 69 73 6b |nse....t|o a disk|
|00002d50| 45 76 74 2c 20 73 6f 20 | 74 68 61 74 20 74 68 65 |Evt, so |that the|
|00002d60| 20 75 73 65 72 20 63 61 | 6e 20 66 6f 72 6d 61 74 | user ca|n format|
|00002d70| 20 61 20 66 6c 6f 70 70 | 79 2e 20 2a 2f 0d 09 09 | a flopp|y. */...|
|00002d80| 63 61 73 65 20 64 69 73 | 6b 45 76 74 3a 0d 09 09 |case dis|kEvt:...|
|00002d90| 09 69 66 20 28 20 48 69 | 57 6f 72 64 28 65 76 65 |.if ( Hi|Word(eve|
|00002da0| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 29 20 21 3d 20 |nt->mess|age) != |
|00002db0| 6e 6f 45 72 72 20 29 20 | 7b 0d 09 09 09 09 53 65 |noErr ) |{.....Se|
|00002dc0| 74 50 74 28 26 61 50 6f | 69 6e 74 2c 20 6b 44 49 |tPt(&aPo|int, kDI|
|00002dd0| 4c 65 66 74 2c 20 6b 44 | 49 54 6f 70 29 3b 0d 09 |Left, kD|ITop);..|
|00002de0| 09 09 09 65 72 72 20 3d | 20 44 49 42 61 64 4d 6f |...err =| DIBadMo|
|00002df0| 75 6e 74 28 61 50 6f 69 | 6e 74 2c 20 65 76 65 6e |unt(aPoi|nt, even|
|00002e00| 74 2d 3e 6d 65 73 73 61 | 67 65 29 3b 0d 09 09 09 |t->messa|ge);....|
|00002e10| 7d 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |}....bre|ak;...ca|
|00002e20| 73 65 20 6b 4f 53 45 76 | 65 6e 74 3a 0d 09 09 09 |se kOSEv|ent:....|
|00002e30| 73 77 69 74 63 68 20 28 | 65 76 65 6e 74 2d 3e 6d |switch (|event->m|
|00002e40| 65 73 73 61 67 65 20 3e | 3e 20 32 34 29 20 7b 09 |essage >|> 24) {.|
|00002e50| 09 2f 2a 20 68 69 67 68 | 20 62 79 74 65 20 6f 66 |./* high| byte of|
|00002e60| 20 6d 65 73 73 61 67 65 | 20 2a 2f 0d 09 09 09 09 | message| */.....|
|00002e70| 63 61 73 65 20 6b 53 75 | 73 70 65 6e 64 52 65 73 |case kSu|spendRes|
|00002e80| 75 6d 65 4d 65 73 73 61 | 67 65 3a 09 09 2f 2a 20 |umeMessa|ge:../* |
|00002e90| 73 75 73 70 65 6e 64 2f | 72 65 73 75 6d 65 20 69 |suspend/|resume i|
|00002ea0| 73 20 61 6c 73 6f 20 61 | 6e 20 61 63 74 69 76 61 |s also a|n activa|
|00002eb0| 74 65 2f 64 65 61 63 74 | 69 76 61 74 65 20 2a 2f |te/deact|ivate */|
|00002ec0| 0d 09 09 09 09 09 67 49 | 6e 42 61 63 6b 67 72 6f |......gI|nBackgro|
|00002ed0| 75 6e 64 20 3d 20 28 65 | 76 65 6e 74 2d 3e 6d 65 |und = (e|vent->me|
|00002ee0| 73 73 61 67 65 20 26 20 | 6b 52 65 73 75 6d 65 4d |ssage & |kResumeM|
|00002ef0| 61 73 6b 29 20 3d 3d 20 | 30 3b 0d 09 09 09 09 09 |ask) == |0;......|
|00002f00| 44 6f 41 63 74 69 76 61 | 74 65 28 46 72 6f 6e 74 |DoActiva|te(Front|
|00002f10| 57 69 6e 64 6f 77 28 29 | 2c 20 21 67 49 6e 42 61 |Window()|, !gInBa|
|00002f20| 63 6b 67 72 6f 75 6e 64 | 29 3b 0d 09 09 09 09 09 |ckground|);......|
|00002f30| 62 72 65 61 6b 3b 0d 09 | 09 09 7d 0d 09 09 09 62 |break;..|..}....b|
|00002f40| 72 65 61 6b 3b 0d 09 7d | 0d 7d 20 2f 2a 44 6f 45 |reak;..}|.} /*DoE|
|00002f50| 76 65 6e 74 2a 2f 0d 0d | 0d 2f 2a 09 43 68 61 6e |vent*/..|./*.Chan|
|00002f60| 67 65 20 74 68 65 20 63 | 75 72 73 6f 72 27 73 20 |ge the c|ursor's |
|00002f70| 73 68 61 70 65 2c 20 64 | 65 70 65 6e 64 69 6e 67 |shape, d|epending|
|00002f80| 20 6f 6e 20 69 74 73 20 | 70 6f 73 69 74 69 6f 6e | on its |position|
|00002f90| 2e 20 54 68 69 73 20 61 | 6c 73 6f 20 63 61 6c 63 |. This a|lso calc|
|00002fa0| 75 6c 61 74 65 73 20 74 | 68 65 20 72 65 67 69 6f |ulates t|he regio|
|00002fb0| 6e 0d 09 77 68 65 72 65 | 20 74 68 65 20 63 75 72 |n..where| the cur|
|00002fc0| 72 65 6e 74 20 63 75 72 | 73 6f 72 20 72 65 73 69 |rent cur|sor resi|
|00002fd0| 64 65 73 20 28 66 6f 72 | 20 57 61 69 74 4e 65 78 |des (for| WaitNex|
|00002fe0| 74 45 76 65 6e 74 29 2e | 20 49 66 20 74 68 65 20 |tEvent).| If the |
|00002ff0| 6d 6f 75 73 65 20 69 73 | 20 65 76 65 72 20 6f 75 |mouse is| ever ou|
|00003000| 74 73 69 64 65 20 6f 66 | 0d 09 74 68 61 74 20 72 |tside of|..that r|
|00003010| 65 67 69 6f 6e 2c 20 61 | 6e 20 65 76 65 6e 74 20 |egion, a|n event |
|00003020| 77 6f 75 6c 64 20 62 65 | 20 67 65 6e 65 72 61 74 |would be| generat|
|00003030| 65 64 2c 20 63 61 75 73 | 69 6e 67 20 74 68 69 73 |ed, caus|ing this|
|00003040| 20 72 6f 75 74 69 6e 65 | 20 74 6f 20 62 65 20 63 | routine| to be c|
|00003050| 61 6c 6c 65 64 2c 0d 09 | 61 6c 6c 6f 77 69 6e 67 |alled,..|allowing|
|00003060| 20 75 73 20 74 6f 20 63 | 68 61 6e 67 65 20 74 68 | us to c|hange th|
|00003070| 65 20 72 65 67 69 6f 6e | 20 74 6f 20 74 68 65 20 |e region| to the |
|00003080| 72 65 67 69 6f 6e 20 74 | 68 65 20 6d 6f 75 73 65 |region t|he mouse|
|00003090| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 69 6e | is curr|ently in|
|000030a0| 2e 20 49 66 0d 09 74 68 | 65 72 65 20 69 73 20 6d |. If..th|ere is m|
|000030b0| 6f 72 65 20 74 6f 20 74 | 68 65 20 65 76 65 6e 74 |ore to t|he event|
|000030c0| 20 74 68 61 6e 20 6a 75 | 73 74 20 d2 74 68 65 20 | than ju|st .the |
|000030d0| 6d 6f 75 73 65 20 6d 6f | 76 65 64 d3 2c 20 77 65 |mouse mo|ved., we|
|000030e0| 20 67 65 74 20 63 61 6c | 6c 65 64 20 62 65 66 6f | get cal|led befo|
|000030f0| 72 65 20 74 68 65 0d 09 | 65 76 65 6e 74 20 69 73 |re the..|event is|
|00003100| 20 70 72 6f 63 65 73 73 | 65 64 20 74 6f 20 6d 61 | process|ed to ma|
|00003110| 6b 65 20 73 75 72 65 20 | 74 68 65 20 63 75 72 73 |ke sure |the curs|
|00003120| 6f 72 20 69 73 20 74 68 | 65 20 72 69 67 68 74 20 |or is th|e right |
|00003130| 6f 6e 65 2e 20 49 6e 20 | 61 6e 79 20 28 61 68 65 |one. In |any (ahe|
|00003140| 6d 29 20 65 76 65 6e 74 | 2c 0d 09 74 68 69 73 20 |m) event|,..this |
|00003150| 69 73 20 63 61 6c 6c 65 | 64 20 61 67 61 69 6e 20 |is calle|d again |
|00003160| 62 65 66 6f 72 65 20 77 | 65 20 66 61 6c 6c 20 62 |before w|e fall b|
|00003170| 61 63 6b 20 69 6e 74 6f | 20 57 4e 45 2e 20 2a 2f |ack into| WNE. */|
|00003180| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|00003190| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 41 64 6a 75 |_ Main.v|oid Adju|
|000031a0| 73 74 43 75 72 73 6f 72 | 28 6d 6f 75 73 65 2c 72 |stCursor|(mouse,r|
|000031b0| 65 67 69 6f 6e 29 0d 09 | 50 6f 69 6e 74 09 09 6d |egion)..|Point..m|
|000031c0| 6f 75 73 65 3b 0d 09 52 | 67 6e 48 61 6e 64 6c 65 |ouse;..R|gnHandle|
|000031d0| 09 72 65 67 69 6f 6e 3b | 0d 7b 0d 09 57 69 6e 64 |.region;|.{..Wind|
|000031e0| 6f 77 50 74 72 09 77 69 | 6e 64 6f 77 3b 0d 09 52 |owPtr.wi|ndow;..R|
|000031f0| 67 6e 48 61 6e 64 6c 65 | 09 61 72 72 6f 77 52 67 |gnHandle|.arrowRg|
|00003200| 6e 3b 0d 09 52 67 6e 48 | 61 6e 64 6c 65 09 70 6c |n;..RgnH|andle.pl|
|00003210| 75 73 52 67 6e 3b 0d 09 | 52 65 63 74 09 09 67 6c |usRgn;..|Rect..gl|
|00003220| 6f 62 61 6c 50 6f 72 74 | 52 65 63 74 3b 0d 0d 09 |obalPort|Rect;...|
|00003230| 77 69 6e 64 6f 77 20 3d | 20 46 72 6f 6e 74 57 69 |window =| FrontWi|
|00003240| 6e 64 6f 77 28 29 3b 09 | 2f 2a 20 77 65 20 6f 6e |ndow();.|/* we on|
|00003250| 6c 79 20 61 64 6a 75 73 | 74 20 74 68 65 20 63 75 |ly adjus|t the cu|
|00003260| 72 73 6f 72 20 77 68 65 | 6e 20 77 65 20 61 72 65 |rsor whe|n we are|
|00003270| 20 69 6e 20 66 72 6f 6e | 74 20 2a 2f 0d 09 69 66 | in fron|t */..if|
|00003280| 20 28 20 28 21 20 67 49 | 6e 42 61 63 6b 67 72 6f | ( (! gI|nBackgro|
|00003290| 75 6e 64 29 20 26 26 20 | 28 21 20 49 73 44 41 57 |und) && |(! IsDAW|
|000032a0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 29 20 29 |indow(wi|ndow)) )|
|000032b0| 20 7b 0d 09 09 2f 2a 20 | 63 61 6c 63 75 6c 61 74 | {.../* |calculat|
|000032c0| 65 20 72 65 67 69 6f 6e | 73 20 66 6f 72 20 64 69 |e region|s for di|
|000032d0| 66 66 65 72 65 6e 74 20 | 63 75 72 73 6f 72 20 73 |fferent |cursor s|
|000032e0| 68 61 70 65 73 20 2a 2f | 0d 09 09 61 72 72 6f 77 |hapes */|...arrow|
|000032f0| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 0d |Rgn = Ne|wRgn();.|
|00003300| 09 09 70 6c 75 73 52 67 | 6e 20 3d 20 4e 65 77 52 |..plusRg|n = NewR|
|00003310| 67 6e 28 29 3b 0d 0d 09 | 09 2f 2a 20 73 74 61 72 |gn();...|./* star|
|00003320| 74 20 77 69 74 68 20 61 | 20 62 69 67 2c 20 62 69 |t with a| big, bi|
|00003330| 67 20 72 65 63 74 61 6e | 67 75 6c 61 72 20 72 65 |g rectan|gular re|
|00003340| 67 69 6f 6e 20 2a 2f 0d | 09 09 53 65 74 52 65 63 |gion */.|..SetRec|
|00003350| 74 52 67 6e 28 61 72 72 | 6f 77 52 67 6e 2c 20 6b |tRgn(arr|owRgn, k|
|00003360| 45 78 74 72 65 6d 65 4e | 65 67 2c 20 6b 45 78 74 |ExtremeN|eg, kExt|
|00003370| 72 65 6d 65 4e 65 67 2c | 20 6b 45 78 74 72 65 6d |remeNeg,| kExtrem|
|00003380| 65 50 6f 73 2c 20 6b 45 | 78 74 72 65 6d 65 50 6f |ePos, kE|xtremePo|
|00003390| 73 29 3b 0d 0d 09 09 2f | 2a 20 63 61 6c 63 75 6c |s);..../|* calcul|
|000033a0| 61 74 65 20 70 6c 75 73 | 52 67 6e 20 2a 2f 0d 09 |ate plus|Rgn */..|
|000033b0| 09 69 66 20 28 20 49 73 | 41 70 70 57 69 6e 64 6f |.if ( Is|AppWindo|
|000033c0| 77 28 77 69 6e 64 6f 77 | 29 20 29 20 7b 0d 09 09 |w(window|) ) {...|
|000033d0| 09 53 65 74 50 6f 72 74 | 28 77 69 6e 64 6f 77 29 |.SetPort|(window)|
|000033e0| 3b 09 2f 2a 20 6d 61 6b | 65 20 61 20 67 6c 6f 62 |;./* mak|e a glob|
|000033f0| 61 6c 20 76 65 72 73 69 | 6f 6e 20 6f 66 20 74 68 |al versi|on of th|
|00003400| 65 20 76 69 65 77 52 65 | 63 74 20 2a 2f 0d 09 09 |e viewRe|ct */...|
|00003410| 09 53 65 74 4f 72 69 67 | 69 6e 28 2d 77 69 6e 64 |.SetOrig|in(-wind|
|00003420| 6f 77 2d 3e 70 6f 72 74 | 42 69 74 73 2e 62 6f 75 |ow->port|Bits.bou|
|00003430| 6e 64 73 2e 6c 65 66 74 | 2c 20 2d 77 69 6e 64 6f |nds.left|, -windo|
|00003440| 77 2d 3e 70 6f 72 74 42 | 69 74 73 2e 62 6f 75 6e |w->portB|its.boun|
|00003450| 64 73 2e 74 6f 70 29 3b | 0d 09 09 09 67 6c 6f 62 |ds.top);|....glob|
|00003460| 61 6c 50 6f 72 74 52 65 | 63 74 20 3d 20 77 69 6e |alPortRe|ct = win|
|00003470| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 3b 0d 09 |dow->por|tRect;..|
|00003480| 09 09 52 65 63 74 52 67 | 6e 28 70 6c 75 73 52 67 |..RectRg|n(plusRg|
|00003490| 6e 2c 20 26 67 6c 6f 62 | 61 6c 50 6f 72 74 52 65 |n, &glob|alPortRe|
|000034a0| 63 74 29 3b 0d 09 09 09 | 53 65 63 74 52 67 6e 28 |ct);....|SectRgn(|
|000034b0| 70 6c 75 73 52 67 6e 2c | 20 77 69 6e 64 6f 77 2d |plusRgn,| window-|
|000034c0| 3e 76 69 73 52 67 6e 2c | 20 70 6c 75 73 52 67 6e |>visRgn,| plusRgn|
|000034d0| 29 3b 0d 09 09 09 53 65 | 74 4f 72 69 67 69 6e 28 |);....Se|tOrigin(|
|000034e0| 30 2c 20 30 29 3b 0d 09 | 09 7d 0d 0d 09 09 2f 2a |0, 0);..|.}..../*|
|000034f0| 20 73 75 62 74 72 61 63 | 74 20 6f 74 68 65 72 20 | subtrac|t other |
|00003500| 72 65 67 69 6f 6e 73 20 | 66 72 6f 6d 20 61 72 72 |regions |from arr|
|00003510| 6f 77 52 67 6e 20 2a 2f | 0d 09 09 44 69 66 66 52 |owRgn */|...DiffR|
|00003520| 67 6e 28 61 72 72 6f 77 | 52 67 6e 2c 20 70 6c 75 |gn(arrow|Rgn, plu|
|00003530| 73 52 67 6e 2c 20 61 72 | 72 6f 77 52 67 6e 29 3b |sRgn, ar|rowRgn);|
|00003540| 0d 0d 09 09 2f 2a 20 63 | 68 61 6e 67 65 20 74 68 |..../* c|hange th|
|00003550| 65 20 63 75 72 73 6f 72 | 20 61 6e 64 20 74 68 65 |e cursor| and the|
|00003560| 20 72 65 67 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 | region |paramete|
|00003570| 72 20 2a 2f 0d 09 09 69 | 66 20 28 20 50 74 49 6e |r */...i|f ( PtIn|
|00003580| 52 67 6e 28 6d 6f 75 73 | 65 2c 20 70 6c 75 73 52 |Rgn(mous|e, plusR|
|00003590| 67 6e 29 20 29 20 7b 0d | 09 09 09 53 65 74 43 75 |gn) ) {.|...SetCu|
|000035a0| 72 73 6f 72 28 2a 47 65 | 74 43 75 72 73 6f 72 28 |rsor(*Ge|tCursor(|
|000035b0| 70 6c 75 73 43 75 72 73 | 6f 72 29 29 3b 0d 09 09 |plusCurs|or));...|
|000035c0| 09 43 6f 70 79 52 67 6e | 28 70 6c 75 73 52 67 6e |.CopyRgn|(plusRgn|
|000035d0| 2c 20 72 65 67 69 6f 6e | 29 3b 0d 09 09 7d 20 65 |, region|);...} e|
|000035e0| 6c 73 65 20 7b 0d 09 09 | 09 53 65 74 43 75 72 73 |lse {...|.SetCurs|
|000035f0| 6f 72 28 26 71 64 2e 61 | 72 72 6f 77 29 3b 0d 09 |or(&qd.a|rrow);..|
|00003600| 09 09 43 6f 70 79 52 67 | 6e 28 61 72 72 6f 77 52 |..CopyRg|n(arrowR|
|00003610| 67 6e 2c 20 72 65 67 69 | 6f 6e 29 3b 0d 09 09 7d |gn, regi|on);...}|
|00003620| 0d 0d 09 09 2f 2a 20 67 | 65 74 20 72 69 64 20 6f |..../* g|et rid o|
|00003630| 66 20 6f 75 72 20 6c 6f | 63 61 6c 20 72 65 67 69 |f our lo|cal regi|
|00003640| 6f 6e 73 20 2a 2f 0d 09 | 09 44 69 73 70 6f 73 65 |ons */..|.Dispose|
|00003650| 52 67 6e 28 61 72 72 6f | 77 52 67 6e 29 3b 0d 09 |Rgn(arro|wRgn);..|
|00003660| 09 44 69 73 70 6f 73 65 | 52 67 6e 28 70 6c 75 73 |.Dispose|Rgn(plus|
|00003670| 52 67 6e 29 3b 0d 09 7d | 0d 7d 20 2f 2a 41 64 6a |Rgn);..}|.} /*Adj|
|00003680| 75 73 74 43 75 72 73 6f | 72 2a 2f 0d 0d 0d 2f 2a |ustCurso|r*/.../*|
|00003690| 09 54 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 |.This is| called |
|000036a0| 77 68 65 6e 20 61 6e 20 | 75 70 64 61 74 65 20 65 |when an |update e|
|000036b0| 76 65 6e 74 20 69 73 20 | 72 65 63 65 69 76 65 64 |vent is |received|
|000036c0| 20 66 6f 72 20 61 20 77 | 69 6e 64 6f 77 2e 0d 09 | for a w|indow...|
|000036d0| 49 74 20 63 61 6c 6c 73 | 20 44 72 61 77 57 69 6e |It calls| DrawWin|
|000036e0| 64 6f 77 20 74 6f 20 64 | 72 61 77 20 74 68 65 20 |dow to d|raw the |
|000036f0| 63 6f 6e 74 65 6e 74 73 | 20 6f 66 20 61 6e 20 61 |contents| of an a|
|00003700| 70 70 6c 69 63 61 74 69 | 6f 6e 20 77 69 6e 64 6f |pplicati|on windo|
|00003710| 77 2e 0d 09 41 73 20 61 | 6e 20 65 66 66 65 63 69 |w...As a|n effeci|
|00003720| 65 6e 63 79 20 6d 65 61 | 73 75 72 65 20 74 68 61 |ency mea|sure tha|
|00003730| 74 20 64 6f 65 73 20 6e | 6f 74 20 68 61 76 65 20 |t does n|ot have |
|00003740| 74 6f 20 62 65 20 66 6f | 6c 6c 6f 77 65 64 2c 20 |to be fo|llowed, |
|00003750| 69 74 0d 09 63 61 6c 6c | 73 20 74 68 65 20 64 72 |it..call|s the dr|
|00003760| 61 77 69 6e 67 20 72 6f | 75 74 69 6e 65 20 6f 6e |awing ro|utine on|
|00003770| 6c 79 20 69 66 20 74 68 | 65 20 76 69 73 52 67 6e |ly if th|e visRgn|
|00003780| 20 69 73 20 6e 6f 6e 2d | 65 6d 70 74 79 2e 20 54 | is non-|empty. T|
|00003790| 68 69 73 0d 09 77 69 6c | 6c 20 68 61 6e 64 6c 65 |his..wil|l handle|
|000037a0| 20 73 69 74 75 61 74 69 | 6f 6e 73 20 77 68 65 72 | situati|ons wher|
|000037b0| 65 20 63 61 6c 63 75 6c | 61 74 69 6f 6e 73 20 66 |e calcul|ations f|
|000037c0| 6f 72 20 64 72 61 77 69 | 6e 67 20 6f 72 20 64 72 |or drawi|ng or dr|
|000037d0| 61 77 69 6e 67 0d 09 69 | 74 73 65 6c 66 20 69 73 |awing..i|tself is|
|000037e0| 20 76 65 72 79 20 74 69 | 6d 65 2d 63 6f 6e 73 75 | very ti|me-consu|
|000037f0| 6d 69 6e 67 2e 20 2a 2f | 0d 0d 23 64 65 66 69 6e |ming. */|..#defin|
|00003800| 65 20 5f 5f 53 45 47 5f | 5f 20 4d 61 69 6e 0d 76 |e __SEG_|_ Main.v|
|00003810| 6f 69 64 20 44 6f 55 70 | 64 61 74 65 28 77 69 6e |oid DoUp|date(win|
|00003820| 64 6f 77 29 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |dow)..Wi|ndowPtr.|
|00003830| 77 69 6e 64 6f 77 3b 0d | 7b 0d 09 69 66 20 28 20 |window;.|{..if ( |
|00003840| 49 73 41 70 70 57 69 6e | 64 6f 77 28 77 69 6e 64 |IsAppWin|dow(wind|
|00003850| 6f 77 29 20 29 20 7b 0d | 09 09 42 65 67 69 6e 55 |ow) ) {.|..BeginU|
|00003860| 70 64 61 74 65 28 77 69 | 6e 64 6f 77 29 3b 09 09 |pdate(wi|ndow);..|
|00003870| 09 09 2f 2a 20 74 68 69 | 73 20 73 65 74 73 20 75 |../* thi|s sets u|
|00003880| 70 20 74 68 65 20 76 69 | 73 52 67 6e 20 2a 2f 0d |p the vi|sRgn */.|
|00003890| 09 09 69 66 20 28 20 21 | 20 45 6d 70 74 79 52 67 |..if ( !| EmptyRg|
|000038a0| 6e 28 77 69 6e 64 6f 77 | 2d 3e 76 69 73 52 67 6e |n(window|->visRgn|
|000038b0| 29 20 29 09 2f 2a 20 64 | 72 61 77 20 69 66 20 75 |) )./* d|raw if u|
|000038c0| 70 64 61 74 69 6e 67 20 | 6e 65 65 64 73 20 74 6f |pdating |needs to|
|000038d0| 20 62 65 20 64 6f 6e 65 | 20 2a 2f 0d 09 09 09 44 | be done| */....D|
|000038e0| 72 61 77 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |rawWindo|w(window|
|000038f0| 29 3b 0d 09 09 45 6e 64 | 55 70 64 61 74 65 28 77 |);...End|Update(w|
|00003900| 69 6e 64 6f 77 29 3b 0d | 09 7d 0d 7d 20 2f 2a 44 |indow);.|.}.} /*D|
|00003910| 6f 55 70 64 61 74 65 2a | 2f 0d 0d 0d 2f 2a 09 54 |oUpdate*|/.../*.T|
|00003920| 68 69 73 20 69 73 20 63 | 61 6c 6c 65 64 20 77 68 |his is c|alled wh|
|00003930| 65 6e 20 61 20 77 69 6e | 64 6f 77 20 69 73 20 61 |en a win|dow is a|
|00003940| 63 74 69 76 61 74 65 64 | 20 6f 72 20 64 65 61 63 |ctivated| or deac|
|00003950| 74 69 76 61 74 65 64 2e | 0d 09 49 6e 20 53 61 6d |tivated.|..In Sam|
|00003960| 70 6c 65 2c 20 74 68 65 | 20 57 69 6e 64 6f 77 20 |ple, the| Window |
|00003970| 4d 61 6e 61 67 65 72 27 | 73 20 68 61 6e 64 6c 69 |Manager'|s handli|
|00003980| 6e 67 20 6f 66 20 61 63 | 74 69 76 61 74 65 20 61 |ng of ac|tivate a|
|00003990| 6e 64 0d 09 64 65 61 63 | 74 69 76 61 74 65 20 65 |nd..deac|tivate e|
|000039a0| 76 65 6e 74 73 20 69 73 | 20 73 75 66 66 69 63 69 |vents is| suffici|
|000039b0| 65 6e 74 2e 20 4f 74 68 | 65 72 20 61 70 70 6c 69 |ent. Oth|er appli|
|000039c0| 63 61 74 69 6f 6e 73 20 | 6d 61 79 20 68 61 76 65 |cations |may have|
|000039d0| 0d 09 54 65 78 74 45 64 | 69 74 20 72 65 63 6f 72 |..TextEd|it recor|
|000039e0| 64 73 2c 20 63 6f 6e 74 | 72 6f 6c 73 2c 20 6c 69 |ds, cont|rols, li|
|000039f0| 73 74 73 2c 20 65 74 63 | 2e 2c 20 74 6f 20 61 63 |sts, etc|., to ac|
|00003a00| 74 69 76 61 74 65 2f 64 | 65 61 63 74 69 76 61 74 |tivate/d|eactivat|
|00003a10| 65 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |e. */..#|define _|
|00003a20| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00003a30| 20 44 6f 41 63 74 69 76 | 61 74 65 28 77 69 6e 64 | DoActiv|ate(wind|
|00003a40| 6f 77 2c 20 62 65 63 6f | 6d 69 6e 67 41 63 74 69 |ow, beco|mingActi|
|00003a50| 76 65 29 0d 09 57 69 6e | 64 6f 77 50 74 72 09 77 |ve)..Win|dowPtr.w|
|00003a60| 69 6e 64 6f 77 3b 0d 09 | 42 6f 6f 6c 65 61 6e 09 |indow;..|Boolean.|
|00003a70| 09 62 65 63 6f 6d 69 6e | 67 41 63 74 69 76 65 3b |.becomin|gActive;|
|00003a80| 0d 7b 0d 09 69 66 20 28 | 20 49 73 41 70 70 57 69 |.{..if (| IsAppWi|
|00003a90| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 20 29 20 7b |ndow(win|dow) ) {|
|00003aa0| 0d 09 09 69 66 20 28 20 | 62 65 63 6f 6d 69 6e 67 |...if ( |becoming|
|00003ab0| 41 63 74 69 76 65 20 29 | 0d 09 09 09 2f 2a 20 64 |Active )|..../* d|
|00003ac0| 6f 20 77 68 61 74 65 76 | 65 72 20 79 6f 75 20 6e |o whatev|er you n|
|00003ad0| 65 65 64 20 74 6f 20 61 | 74 20 61 63 74 69 76 61 |eed to a|t activa|
|00003ae0| 74 69 6f 6e 20 2a 2f 20 | 3b 0d 09 09 65 6c 73 65 |tion */ |;...else|
|00003af0| 0d 09 09 09 2f 2a 20 64 | 6f 20 77 68 61 74 65 76 |..../* d|o whatev|
|00003b00| 65 72 20 79 6f 75 20 6e | 65 65 64 20 74 6f 20 61 |er you n|eed to a|
|00003b10| 74 20 64 65 61 63 74 69 | 76 61 74 69 6f 6e 20 2a |t deacti|vation *|
|00003b20| 2f 20 3b 0d 09 7d 0d 7d | 20 2f 2a 44 6f 41 63 74 |/ ;..}.}| /*DoAct|
|00003b30| 69 76 61 74 65 2a 2f 0d | 0d 0d 2f 2a 09 54 68 69 |ivate*/.|../*.Thi|
|00003b40| 73 20 69 73 20 63 61 6c | 6c 65 64 20 77 68 65 6e |s is cal|led when|
|00003b50| 20 61 20 6d 6f 75 73 65 | 2d 64 6f 77 6e 20 65 76 | a mouse|-down ev|
|00003b60| 65 6e 74 20 6f 63 63 75 | 72 73 20 69 6e 20 74 68 |ent occu|rs in th|
|00003b70| 65 20 63 6f 6e 74 65 6e | 74 20 6f 66 20 61 20 77 |e conten|t of a w|
|00003b80| 69 6e 64 6f 77 2e 0d 09 | 4f 74 68 65 72 20 61 70 |indow...|Other ap|
|00003b90| 70 6c 69 63 61 74 69 6f | 6e 73 20 6d 69 67 68 74 |plicatio|ns might|
|00003ba0| 20 77 61 6e 74 20 74 6f | 20 63 61 6c 6c 20 46 69 | want to| call Fi|
|00003bb0| 6e 64 43 6f 6e 74 72 6f | 6c 2c 20 54 45 43 6c 69 |ndContro|l, TECli|
|00003bc0| 63 6b 2c 20 65 74 63 2e | 2c 20 74 6f 0d 09 66 75 |ck, etc.|, to..fu|
|00003bd0| 72 74 68 65 72 20 70 72 | 6f 63 65 73 73 20 74 68 |rther pr|ocess th|
|00003be0| 65 20 63 6c 69 63 6b 2e | 20 2a 2f 0d 0d 23 64 65 |e click.| */..#de|
|00003bf0| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 4d 61 69 |fine __S|EG__ Mai|
|00003c00| 6e 0d 76 6f 69 64 20 44 | 6f 43 6f 6e 74 65 6e 74 |n.void D|oContent|
|00003c10| 43 6c 69 63 6b 28 77 69 | 6e 64 6f 77 29 0d 09 57 |Click(wi|ndow)..W|
|00003c20| 69 6e 64 6f 77 50 74 72 | 09 77 69 6e 64 6f 77 3b |indowPtr|.window;|
|00003c30| 0d 7b 0d 09 53 65 74 4c | 69 67 68 74 28 77 69 6e |.{..SetL|ight(win|
|00003c40| 64 6f 77 2c 20 21 20 67 | 53 74 6f 70 70 65 64 29 |dow, ! g|Stopped)|
|00003c50| 3b 0d 7d 20 2f 2a 44 6f | 43 6f 6e 74 65 6e 74 43 |;.} /*Do|ContentC|
|00003c60| 6c 69 63 6b 2a 2f 0d 0d | 0d 2f 2a 20 44 72 61 77 |lick*/..|./* Draw|
|00003c70| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 73 20 6f 66 | the con|tents of|
|00003c80| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|00003c90| 20 77 69 6e 64 6f 77 2e | 20 57 65 20 64 6f 20 73 | window.| We do s|
|00003ca0| 6f 6d 65 20 64 72 61 77 | 69 6e 67 20 69 6e 20 63 |ome draw|ing in c|
|00003cb0| 6f 6c 6f 72 2c 20 75 73 | 69 6e 67 0d 20 20 20 43 |olor, us|ing. C|
|00003cc0| 6c 61 73 73 69 63 20 51 | 75 69 63 6b 44 72 61 77 |lassic Q|uickDraw|
|00003cd0| 27 73 20 63 6f 6c 6f 72 | 20 63 61 70 61 62 69 6c |'s color| capabil|
|00003ce0| 69 74 69 65 73 2e 20 54 | 68 69 73 20 77 69 6c 6c |ities. T|his will|
|00003cf0| 20 62 65 20 62 6c 61 63 | 6b 20 61 6e 64 20 77 68 | be blac|k and wh|
|00003d00| 69 74 65 20 6f 6e 20 6f | 6c 64 0d 20 20 20 6d 61 |ite on o|ld. ma|
|00003d10| 63 68 69 6e 65 73 2c 20 | 62 75 74 20 63 6f 6c 6f |chines, |but colo|
|00003d20| 72 20 6f 6e 20 63 6f 6c | 6f 72 20 6d 61 63 68 69 |r on col|or machi|
|00003d30| 6e 65 73 2e 20 41 74 20 | 74 68 69 73 20 70 6f 69 |nes. At |this poi|
|00003d40| 6e 74 2c 20 74 68 65 20 | 77 69 6e 64 6f 77 d5 73 |nt, the |window.s|
|00003d50| 20 76 69 73 52 67 6e 0d | 20 20 20 69 73 20 73 65 | visRgn.| is se|
|00003d60| 74 20 74 6f 20 61 6c 6c | 6f 77 20 64 72 61 77 69 |t to all|ow drawi|
|00003d70| 6e 67 20 6f 6e 6c 79 20 | 77 68 65 72 65 20 69 74 |ng only |where it|
|00003d80| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 64 6f 6e | needs t|o be don|
|00003d90| 65 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |e. */..#|define _|
|00003da0| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00003db0| 20 44 72 61 77 57 69 6e | 64 6f 77 28 77 69 6e 64 | DrawWin|dow(wind|
|00003dc0| 6f 77 29 0d 09 57 69 6e | 64 6f 77 50 74 72 09 77 |ow)..Win|dowPtr.w|
|00003dd0| 69 6e 64 6f 77 3b 0d 7b | 0d 09 53 65 74 50 6f 72 |indow;.{|..SetPor|
|00003de0| 74 28 77 69 6e 64 6f 77 | 29 3b 0d 0d 09 45 72 61 |t(window|);...Era|
|00003df0| 73 65 52 65 63 74 28 26 | 77 69 6e 64 6f 77 2d 3e |seRect(&|window->|
|00003e00| 70 6f 72 74 52 65 63 74 | 29 3b 09 2f 2a 20 63 6c |portRect|);./* cl|
|00003e10| 65 61 72 20 6f 75 74 20 | 61 6e 79 20 67 61 72 62 |ear out |any garb|
|00003e20| 61 67 65 20 74 68 61 74 | 20 6d 61 79 20 6c 69 6e |age that| may lin|
|00003e30| 67 65 72 20 2a 2f 0d 09 | 69 66 20 28 20 67 53 74 |ger */..|if ( gSt|
|00003e40| 6f 70 70 65 64 20 29 09 | 09 09 09 09 2f 2a 20 64 |opped ).|..../* d|
|00003e50| 72 61 77 20 61 20 72 65 | 64 20 28 6f 72 20 77 68 |raw a re|d (or wh|
|00003e60| 69 74 65 29 20 73 74 6f | 70 20 6c 69 67 68 74 20 |ite) sto|p light |
|00003e70| 2a 2f 0d 09 09 46 6f 72 | 65 43 6f 6c 6f 72 28 72 |*/...For|eColor(r|
|00003e80| 65 64 43 6f 6c 6f 72 29 | 3b 0d 09 65 6c 73 65 0d |edColor)|;..else.|
|00003e90| 09 09 46 6f 72 65 43 6f | 6c 6f 72 28 77 68 69 74 |..ForeCo|lor(whit|
|00003ea0| 65 43 6f 6c 6f 72 29 3b | 0d 09 50 61 69 6e 74 4f |eColor);|..PaintO|
|00003eb0| 76 61 6c 28 26 67 53 74 | 6f 70 52 65 63 74 29 3b |val(&gSt|opRect);|
|00003ec0| 0d 09 46 6f 72 65 43 6f | 6c 6f 72 28 62 6c 61 63 |..ForeCo|lor(blac|
|00003ed0| 6b 43 6f 6c 6f 72 29 3b | 0d 09 46 72 61 6d 65 4f |kColor);|..FrameO|
|00003ee0| 76 61 6c 28 26 67 53 74 | 6f 70 52 65 63 74 29 3b |val(&gSt|opRect);|
|00003ef0| 0d 09 69 66 20 28 20 21 | 20 67 53 74 6f 70 70 65 |..if ( !| gStoppe|
|00003f00| 64 20 29 09 09 09 09 2f | 2a 20 64 72 61 77 20 61 |d )..../|* draw a|
|00003f10| 20 67 72 65 65 6e 20 28 | 6f 72 20 77 68 69 74 65 | green (|or white|
|00003f20| 29 20 67 6f 20 6c 69 67 | 68 74 20 2a 2f 0d 09 09 |) go lig|ht */...|
|00003f30| 46 6f 72 65 43 6f 6c 6f | 72 28 67 72 65 65 6e 43 |ForeColo|r(greenC|
|00003f40| 6f 6c 6f 72 29 3b 0d 09 | 65 6c 73 65 0d 09 09 46 |olor);..|else...F|
|00003f50| 6f 72 65 43 6f 6c 6f 72 | 28 77 68 69 74 65 43 6f |oreColor|(whiteCo|
|00003f60| 6c 6f 72 29 3b 0d 09 50 | 61 69 6e 74 4f 76 61 6c |lor);..P|aintOval|
|00003f70| 28 26 67 47 6f 52 65 63 | 74 29 3b 0d 09 46 6f 72 |(&gGoRec|t);..For|
|00003f80| 65 43 6f 6c 6f 72 28 62 | 6c 61 63 6b 43 6f 6c 6f |eColor(b|lackColo|
|00003f90| 72 29 3b 0d 09 46 72 61 | 6d 65 4f 76 61 6c 28 26 |r);..Fra|meOval(&|
|00003fa0| 67 47 6f 52 65 63 74 29 | 3b 0d 7d 20 2f 2a 44 72 |gGoRect)|;.} /*Dr|
|00003fb0| 61 77 57 69 6e 64 6f 77 | 2a 2f 0d 0d 0d 2f 2a 09 |awWindow|*/.../*.|
|00003fc0| 45 6e 61 62 6c 65 20 61 | 6e 64 20 64 69 73 61 62 |Enable a|nd disab|
|00003fd0| 6c 65 20 6d 65 6e 75 73 | 20 62 61 73 65 64 20 6f |le menus| based o|
|00003fe0| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 73 74 |n the cu|rrent st|
|00003ff0| 61 74 65 2e 0d 09 54 68 | 65 20 75 73 65 72 20 63 |ate...Th|e user c|
|00004000| 61 6e 20 6f 6e 6c 79 20 | 73 65 6c 65 63 74 20 65 |an only |select e|
|00004010| 6e 61 62 6c 65 64 20 6d | 65 6e 75 20 69 74 65 6d |nabled m|enu item|
|00004020| 73 2e 20 57 65 20 73 65 | 74 20 75 70 20 61 6c 6c |s. We se|t up all|
|00004030| 20 74 68 65 20 6d 65 6e | 75 20 69 74 65 6d 73 0d | the men|u items.|
|00004040| 09 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 |.before |calling |
|00004050| 4d 65 6e 75 53 65 6c 65 | 63 74 20 6f 72 20 4d 65 |MenuSele|ct or Me|
|00004060| 6e 75 4b 65 79 2c 20 73 | 69 6e 63 65 20 74 68 65 |nuKey, s|ince the|
|00004070| 73 65 20 61 72 65 20 74 | 68 65 20 6f 6e 6c 79 20 |se are t|he only |
|00004080| 74 69 6d 65 73 20 74 68 | 61 74 0d 09 61 20 6d 65 |times th|at..a me|
|00004090| 6e 75 20 69 74 65 6d 20 | 63 61 6e 20 62 65 20 73 |nu item |can be s|
|000040a0| 65 6c 65 63 74 65 64 2e | 20 4e 6f 74 65 20 74 68 |elected.| Note th|
|000040b0| 61 74 20 4d 65 6e 75 53 | 65 6c 65 63 74 20 69 73 |at MenuS|elect is|
|000040c0| 20 61 6c 73 6f 20 74 68 | 65 20 6f 6e 6c 79 20 74 | also th|e only t|
|000040d0| 69 6d 65 0d 09 74 68 65 | 20 75 73 65 72 20 77 69 |ime..the| user wi|
|000040e0| 6c 6c 20 73 65 65 20 6d | 65 6e 75 20 69 74 65 6d |ll see m|enu item|
|000040f0| 73 2e 20 54 68 69 73 20 | 61 70 70 72 6f 61 63 68 |s. This |approach|
|00004100| 20 74 6f 20 64 65 63 69 | 64 69 6e 67 20 77 68 61 | to deci|ding wha|
|00004110| 74 20 65 6e 61 62 6c 65 | 2f 0d 09 64 69 73 61 62 |t enable|/..disab|
|00004120| 6c 65 20 73 74 61 74 65 | 20 61 20 6d 65 6e 75 20 |le state| a menu |
|00004130| 69 74 65 6d 20 68 61 73 | 20 74 68 65 20 61 64 76 |item has| the adv|
|00004140| 61 6e 74 61 67 65 20 6f | 66 20 63 6f 6e 63 65 6e |antage o|f concen|
|00004150| 74 72 61 74 69 6e 67 20 | 61 6c 6c 0d 09 74 68 65 |trating |all..the|
|00004160| 20 64 65 63 69 73 69 6f | 6e 2d 6d 61 6b 69 6e 67 | decisio|n-making|
|00004170| 20 69 6e 20 6f 6e 65 20 | 72 6f 75 74 69 6e 65 2c | in one |routine,|
|00004180| 20 61 73 20 6f 70 70 6f | 73 65 64 20 74 6f 20 62 | as oppo|sed to b|
|00004190| 65 69 6e 67 20 73 70 72 | 65 61 64 20 74 68 72 6f |eing spr|ead thro|
|000041a0| 75 67 68 6f 75 74 0d 09 | 74 68 65 20 61 70 70 6c |ughout..|the appl|
|000041b0| 69 63 61 74 69 6f 6e 2e | 20 4f 74 68 65 72 20 61 |ication.| Other a|
|000041c0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 64 65 73 69 67 |pplicati|on desig|
|000041d0| 6e 73 20 6d 61 79 20 74 | 61 6b 65 20 61 20 64 69 |ns may t|ake a di|
|000041e0| 66 66 65 72 65 6e 74 20 | 61 70 70 72 6f 61 63 68 |fferent |approach|
|000041f0| 0d 09 74 68 61 74 20 69 | 73 20 6a 75 73 74 20 61 |..that i|s just a|
|00004200| 73 20 76 61 6c 69 64 2e | 20 2a 2f 0d 0d 23 64 65 |s valid.| */..#de|
|00004210| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 4d 61 69 |fine __S|EG__ Mai|
|00004220| 6e 0d 76 6f 69 64 20 41 | 64 6a 75 73 74 4d 65 6e |n.void A|djustMen|
|00004230| 75 73 28 29 0d 7b 0d 09 | 57 69 6e 64 6f 77 50 74 |us().{..|WindowPt|
|00004240| 72 09 77 69 6e 64 6f 77 | 3b 0d 09 4d 65 6e 75 48 |r.window|;..MenuH|
|00004250| 61 6e 64 6c 65 09 6d 65 | 6e 75 3b 0d 0d 09 77 69 |andle.me|nu;...wi|
|00004260| 6e 64 6f 77 20 3d 20 46 | 72 6f 6e 74 57 69 6e 64 |ndow = F|rontWind|
|00004270| 6f 77 28 29 3b 0d 0d 09 | 6d 65 6e 75 20 3d 20 47 |ow();...|menu = G|
|00004280| 65 74 4d 48 61 6e 64 6c | 65 28 6d 46 69 6c 65 29 |etMHandl|e(mFile)|
|00004290| 3b 0d 09 69 66 20 28 20 | 49 73 44 41 57 69 6e 64 |;..if ( |IsDAWind|
|000042a0| 6f 77 28 77 69 6e 64 6f | 77 29 20 29 09 09 2f 2a |ow(windo|w) )../*|
|000042b0| 20 77 65 20 63 61 6e 20 | 61 6c 6c 6f 77 20 64 65 | we can |allow de|
|000042c0| 73 6b 20 61 63 63 65 73 | 73 6f 72 69 65 73 20 74 |sk acces|sories t|
|000042d0| 6f 20 62 65 20 63 6c 6f | 73 65 64 20 66 72 6f 6d |o be clo|sed from|
|000042e0| 20 74 68 65 20 6d 65 6e | 75 20 2a 2f 0d 09 09 45 | the men|u */...E|
|000042f0| 6e 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |nableIte|m(menu, |
|00004300| 69 43 6c 6f 73 65 29 3b | 0d 09 65 6c 73 65 0d 09 |iClose);|..else..|
|00004310| 09 44 69 73 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |.Disable|Item(men|
|00004320| 75 2c 20 69 43 6c 6f 73 | 65 29 3b 09 2f 2a 20 62 |u, iClos|e);./* b|
|00004330| 75 74 20 6e 6f 74 20 6f | 75 72 20 74 72 61 66 66 |ut not o|ur traff|
|00004340| 69 63 20 6c 69 67 68 74 | 20 77 69 6e 64 6f 77 20 |ic light| window |
|00004350| 2a 2f 0d 0d 09 6d 65 6e | 75 20 3d 20 47 65 74 4d |*/...men|u = GetM|
|00004360| 48 61 6e 64 6c 65 28 6d | 45 64 69 74 29 3b 0d 09 |Handle(m|Edit);..|
|00004370| 69 66 20 28 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |if ( IsD|AWindow(|
|00004380| 77 69 6e 64 6f 77 29 20 | 29 20 7b 09 09 2f 2a 20 |window) |) {../* |
|00004390| 61 20 64 65 73 6b 20 61 | 63 63 65 73 73 6f 72 79 |a desk a|ccessory|
|000043a0| 20 6d 69 67 68 74 20 6e | 65 65 64 20 74 68 65 20 | might n|eed the |
|000043b0| 65 64 69 74 20 6d 65 6e | 75 c9 20 2a 2f 0d 09 09 |edit men|u. */...|
|000043c0| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|000043d0| 20 69 55 6e 64 6f 29 3b | 0d 09 09 45 6e 61 62 6c | iUndo);|...Enabl|
|000043e0| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 43 75 74 |eItem(me|nu, iCut|
|000043f0| 29 3b 0d 09 09 45 6e 61 | 62 6c 65 49 74 65 6d 28 |);...Ena|bleItem(|
|00004400| 6d 65 6e 75 2c 20 69 43 | 6f 70 79 29 3b 0d 09 09 |menu, iC|opy);...|
|00004410| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00004420| 20 69 43 6c 65 61 72 29 | 3b 0d 09 09 45 6e 61 62 | iClear)|;...Enab|
|00004430| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 50 61 |leItem(m|enu, iPa|
|00004440| 73 74 65 29 3b 0d 09 7d | 20 65 6c 73 65 20 7b 09 |ste);..}| else {.|
|00004450| 09 09 09 09 09 2f 2a 20 | c9 62 75 74 20 77 65 20 |...../* |.but we |
|00004460| 64 6f 6e d5 74 20 75 73 | 65 20 69 74 20 2a 2f 0d |don.t us|e it */.|
|00004470| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00004480| 6e 75 2c 20 69 55 6e 64 | 6f 29 3b 0d 09 09 44 69 |nu, iUnd|o);...Di|
|00004490| 73 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |sableIte|m(menu, |
|000044a0| 69 43 75 74 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |iCut);..|.Disable|
|000044b0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 6f 70 79 |Item(men|u, iCopy|
|000044c0| 29 3b 0d 09 09 44 69 73 | 61 62 6c 65 49 74 65 6d |);...Dis|ableItem|
|000044d0| 28 6d 65 6e 75 2c 20 69 | 43 6c 65 61 72 29 3b 0d |(menu, i|Clear);.|
|000044e0| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|000044f0| 6e 75 2c 20 69 50 61 73 | 74 65 29 3b 0d 09 7d 0d |nu, iPas|te);..}.|
|00004500| 0d 09 6d 65 6e 75 20 3d | 20 47 65 74 4d 48 61 6e |..menu =| GetMHan|
|00004510| 64 6c 65 28 6d 4c 69 67 | 68 74 29 3b 0d 09 69 66 |dle(mLig|ht);..if|
|00004520| 20 28 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 77 | ( IsApp|Window(w|
|00004530| 69 6e 64 6f 77 29 20 29 | 20 7b 09 2f 2a 20 77 65 |indow) )| {./* we|
|00004540| 20 6b 6e 6f 77 20 74 68 | 61 74 20 69 74 20 6d 75 | know th|at it mu|
|00004550| 73 74 20 62 65 20 74 68 | 65 20 74 72 61 66 66 69 |st be th|e traffi|
|00004560| 63 20 6c 69 67 68 74 20 | 2a 2f 0d 09 09 45 6e 61 |c light |*/...Ena|
|00004570| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 53 |bleItem(|menu, iS|
|00004580| 74 6f 70 29 3b 0d 09 09 | 45 6e 61 62 6c 65 49 74 |top);...|EnableIt|
|00004590| 65 6d 28 6d 65 6e 75 2c | 20 69 47 6f 29 3b 0d 09 |em(menu,| iGo);..|
|000045a0| 7d 20 65 6c 73 65 20 7b | 0d 09 09 44 69 73 61 62 |} else {|...Disab|
|000045b0| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 53 74 |leItem(m|enu, iSt|
|000045c0| 6f 70 29 3b 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |op);...D|isableIt|
|000045d0| 65 6d 28 6d 65 6e 75 2c | 20 69 47 6f 29 3b 0d 09 |em(menu,| iGo);..|
|000045e0| 7d 0d 09 43 68 65 63 6b | 49 74 65 6d 28 6d 65 6e |}..Check|Item(men|
|000045f0| 75 2c 20 69 53 74 6f 70 | 2c 20 67 53 74 6f 70 70 |u, iStop|, gStopp|
|00004600| 65 64 29 3b 20 2f 2a 20 | 77 65 20 63 61 6e 20 61 |ed); /* |we can a|
|00004610| 6c 73 6f 20 64 65 74 65 | 72 6d 69 6e 65 20 63 68 |lso dete|rmine ch|
|00004620| 65 63 6b 2f 75 6e 63 68 | 65 63 6b 20 73 74 61 74 |eck/unch|eck stat|
|00004630| 65 2c 20 74 6f 6f 20 2a | 2f 0d 09 43 68 65 63 6b |e, too *|/..Check|
|00004640| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 47 6f 2c 20 |Item(men|u, iGo, |
|00004650| 21 20 67 53 74 6f 70 70 | 65 64 29 3b 0d 7d 20 2f |! gStopp|ed);.} /|
|00004660| 2a 41 64 6a 75 73 74 4d | 65 6e 75 73 2a 2f 0d 0d |*AdjustM|enus*/..|
|00004670| 0d 2f 2a 09 54 68 69 73 | 20 69 73 20 63 61 6c 6c |./*.This| is call|
|00004680| 65 64 20 77 68 65 6e 20 | 61 6e 20 69 74 65 6d 20 |ed when |an item |
|00004690| 69 73 20 63 68 6f 73 65 | 6e 20 66 72 6f 6d 20 74 |is chose|n from t|
|000046a0| 68 65 20 6d 65 6e 75 20 | 62 61 72 20 28 61 66 74 |he menu |bar (aft|
|000046b0| 65 72 20 63 61 6c 6c 69 | 6e 67 0d 09 4d 65 6e 75 |er calli|ng..Menu|
|000046c0| 53 65 6c 65 63 74 20 6f | 72 20 4d 65 6e 75 4b 65 |Select o|r MenuKe|
|000046d0| 79 29 2e 20 49 74 20 70 | 65 72 66 6f 72 6d 73 20 |y). It p|erforms |
|000046e0| 74 68 65 20 72 69 67 68 | 74 20 6f 70 65 72 61 74 |the righ|t operat|
|000046f0| 69 6f 6e 20 66 6f 72 20 | 65 61 63 68 20 63 6f 6d |ion for |each com|
|00004700| 6d 61 6e 64 2e 0d 09 49 | 74 20 69 73 20 67 6f 6f |mand...I|t is goo|
|00004710| 64 20 74 6f 20 68 61 76 | 65 20 62 6f 74 68 20 74 |d to hav|e both t|
|00004720| 68 65 20 72 65 73 75 6c | 74 20 6f 66 20 4d 65 6e |he resul|t of Men|
|00004730| 75 53 65 6c 65 63 74 20 | 61 6e 64 20 4d 65 6e 75 |uSelect |and Menu|
|00004740| 4b 65 79 20 67 6f 20 74 | 6f 0d 09 6f 6e 65 20 72 |Key go t|o..one r|
|00004750| 6f 75 74 69 6e 65 20 6c | 69 6b 65 20 74 68 69 73 |outine l|ike this|
|00004760| 20 74 6f 20 6b 65 65 70 | 20 65 76 65 72 79 74 68 | to keep| everyth|
|00004770| 69 6e 67 20 6f 72 67 61 | 6e 69 7a 65 64 2e 20 2a |ing orga|nized. *|
|00004780| 2f 0d 0d 23 64 65 66 69 | 6e 65 20 5f 5f 53 45 47 |/..#defi|ne __SEG|
|00004790| 5f 5f 20 4d 61 69 6e 0d | 76 6f 69 64 20 44 6f 4d |__ Main.|void DoM|
|000047a0| 65 6e 75 43 6f 6d 6d 61 | 6e 64 28 6d 65 6e 75 52 |enuComma|nd(menuR|
|000047b0| 65 73 75 6c 74 29 0d 09 | 6c 6f 6e 67 09 09 6d 65 |esult)..|long..me|
|000047c0| 6e 75 52 65 73 75 6c 74 | 3b 0d 7b 0d 09 73 68 6f |nuResult|;.{..sho|
|000047d0| 72 74 09 09 6d 65 6e 75 | 49 44 3b 09 09 09 09 2f |rt..menu|ID;..../|
|000047e0| 2a 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 49 |* the re|source I|
|000047f0| 44 20 6f 66 20 74 68 65 | 20 73 65 6c 65 63 74 65 |D of the| selecte|
|00004800| 64 20 6d 65 6e 75 20 2a | 2f 0d 09 73 68 6f 72 74 |d menu *|/..short|
|00004810| 09 09 6d 65 6e 75 49 74 | 65 6d 3b 09 09 09 2f 2a |..menuIt|em;.../*|
|00004820| 20 74 68 65 20 69 74 65 | 6d 20 6e 75 6d 62 65 72 | the ite|m number|
|00004830| 20 6f 66 20 74 68 65 20 | 73 65 6c 65 63 74 65 64 | of the |selected|
|00004840| 20 6d 65 6e 75 20 2a 2f | 0d 09 73 68 6f 72 74 09 | menu */|..short.|
|00004850| 09 69 74 65 6d 48 69 74 | 3b 0d 09 53 74 72 32 35 |.itemHit|;..Str25|
|00004860| 35 09 09 64 61 4e 61 6d | 65 3b 0d 09 73 68 6f 72 |5..daNam|e;..shor|
|00004870| 74 09 09 64 61 52 65 66 | 4e 75 6d 3b 0d 09 42 6f |t..daRef|Num;..Bo|
|00004880| 6f 6c 65 61 6e 09 09 68 | 61 6e 64 6c 65 64 42 79 |olean..h|andledBy|
|00004890| 44 41 3b 0d 0d 09 6d 65 | 6e 75 49 44 20 3d 20 48 |DA;...me|nuID = H|
|000048a0| 69 57 6f 72 64 28 6d 65 | 6e 75 52 65 73 75 6c 74 |iWord(me|nuResult|
|000048b0| 29 3b 09 2f 2a 20 75 73 | 65 20 6d 61 63 72 6f 73 |);./* us|e macros|
|000048c0| 20 66 6f 72 20 65 66 66 | 69 63 69 65 6e 63 79 20 | for eff|iciency |
|000048d0| 74 6f 2e 2e 2e 20 2a 2f | 0d 09 6d 65 6e 75 49 74 |to... */|..menuIt|
|000048e0| 65 6d 20 3d 20 4c 6f 57 | 6f 72 64 28 6d 65 6e 75 |em = LoW|ord(menu|
|000048f0| 52 65 73 75 6c 74 29 3b | 09 2f 2a 20 67 65 74 20 |Result);|./* get |
|00004900| 6d 65 6e 75 20 69 74 65 | 6d 20 6e 75 6d 62 65 72 |menu ite|m number|
|00004910| 20 61 6e 64 20 6d 65 6e | 75 20 6e 75 6d 62 65 72 | and men|u number|
|00004920| 20 2a 2f 0d 09 73 77 69 | 74 63 68 20 28 20 6d 65 | */..swi|tch ( me|
|00004930| 6e 75 49 44 20 29 20 7b | 0d 09 09 63 61 73 65 20 |nuID ) {|...case |
|00004940| 6d 41 70 70 6c 65 3a 0d | 09 09 09 73 77 69 74 63 |mApple:.|...switc|
|00004950| 68 20 28 20 6d 65 6e 75 | 49 74 65 6d 20 29 20 7b |h ( menu|Item ) {|
|00004960| 0d 09 09 09 09 63 61 73 | 65 20 69 41 62 6f 75 74 |.....cas|e iAbout|
|00004970| 3a 09 09 2f 2a 20 62 72 | 69 6e 67 20 75 70 20 61 |:../* br|ing up a|
|00004980| 6c 65 72 74 20 66 6f 72 | 20 41 62 6f 75 74 20 2a |lert for| About *|
|00004990| 2f 0d 09 09 09 09 09 69 | 74 65 6d 48 69 74 20 3d |/......i|temHit =|
|000049a0| 20 41 6c 65 72 74 28 72 | 41 62 6f 75 74 41 6c 65 | Alert(r|AboutAle|
|000049b0| 72 74 2c 20 6e 69 6c 29 | 3b 0d 09 09 09 09 09 62 |rt, nil)|;......b|
|000049c0| 72 65 61 6b 3b 0d 09 09 | 09 09 64 65 66 61 75 6c |reak;...|..defaul|
|000049d0| 74 3a 09 09 09 2f 2a 20 | 61 6c 6c 20 6e 6f 6e 2d |t:.../* |all non-|
|000049e0| 41 62 6f 75 74 20 69 74 | 65 6d 73 20 69 6e 20 74 |About it|ems in t|
|000049f0| 68 69 73 20 6d 65 6e 75 | 20 61 72 65 20 44 41 73 |his menu| are DAs|
|00004a00| 20 2a 2f 0d 23 09 09 09 | 09 09 69 66 6e 64 65 66 | */.#...|..ifndef|
|00004a10| 20 4d 50 57 33 0d 09 09 | 09 09 09 09 2f 2a 20 74 | MPW3...|..../* t|
|00004a20| 79 70 65 20 53 74 72 32 | 35 35 20 69 73 20 61 20 |ype Str2|55 is a |
|00004a30| 73 74 72 75 63 74 20 69 | 6e 20 4d 50 57 20 32 20 |struct i|n MPW 2 |
|00004a40| 2a 2f 0d 09 09 09 09 09 | 09 47 45 54 49 54 45 4d |*/......|.GETITEM|
|00004a50| 28 47 65 74 4d 48 61 6e | 64 6c 65 28 6d 41 70 70 |(GetMHan|dle(mApp|
|00004a60| 6c 65 29 2c 20 6d 65 6e | 75 49 74 65 6d 2c 20 26 |le), men|uItem, &|
|00004a70| 64 61 4e 61 6d 65 29 3b | 0d 09 09 09 09 09 09 64 |daName);|.......d|
|00004a80| 61 52 65 66 4e 75 6d 20 | 3d 20 4f 50 45 4e 44 45 |aRefNum |= OPENDE|
|00004a90| 53 4b 41 43 43 28 26 64 | 61 4e 61 6d 65 29 3b 0d |SKACC(&d|aName);.|
|00004aa0| 23 09 09 09 09 09 65 6c | 73 65 0d 09 09 09 09 09 |#.....el|se......|
|00004ab0| 09 2f 2a 20 74 79 70 65 | 20 53 74 72 32 35 35 20 |./* type| Str255 |
|00004ac0| 69 73 20 61 6e 20 61 72 | 72 61 79 20 69 6e 20 4d |is an ar|ray in M|
|00004ad0| 50 57 20 33 20 2a 2f 0d | 09 09 09 09 09 09 47 65 |PW 3 */.|......Ge|
|00004ae0| 74 49 74 65 6d 28 47 65 | 74 4d 48 61 6e 64 6c 65 |tItem(Ge|tMHandle|
|00004af0| 28 6d 41 70 70 6c 65 29 | 2c 20 6d 65 6e 75 49 74 |(mApple)|, menuIt|
|00004b00| 65 6d 2c 20 64 61 4e 61 | 6d 65 29 3b 0d 09 09 09 |em, daNa|me);....|
|00004b10| 09 09 09 64 61 52 65 66 | 4e 75 6d 20 3d 20 4f 70 |...daRef|Num = Op|
|00004b20| 65 6e 44 65 73 6b 41 63 | 63 28 64 61 4e 61 6d 65 |enDeskAc|c(daName|
|00004b30| 29 3b 0d 23 09 09 09 09 | 09 65 6e 64 69 66 0d 09 |);.#....|.endif..|
|00004b40| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 7d 0d |....brea|k;....}.|
|00004b50| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00004b60| 20 6d 46 69 6c 65 3a 0d | 09 09 09 73 77 69 74 63 | mFile:.|...switc|
|00004b70| 68 20 28 20 6d 65 6e 75 | 49 74 65 6d 20 29 20 7b |h ( menu|Item ) {|
|00004b80| 0d 09 09 09 09 63 61 73 | 65 20 69 43 6c 6f 73 65 |.....cas|e iClose|
|00004b90| 3a 0d 09 09 09 09 09 44 | 6f 43 6c 6f 73 65 57 69 |:......D|oCloseWi|
|00004ba0| 6e 64 6f 77 28 46 72 6f | 6e 74 57 69 6e 64 6f 77 |ndow(Fro|ntWindow|
|00004bb0| 28 29 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |());....|..break;|
|00004bc0| 0d 09 09 09 09 63 61 73 | 65 20 69 51 75 69 74 3a |.....cas|e iQuit:|
|00004bd0| 0d 09 09 09 09 09 54 65 | 72 6d 69 6e 61 74 65 28 |......Te|rminate(|
|00004be0| 29 3b 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |);......|break;..|
|00004bf0| 09 09 7d 0d 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |..}....b|reak;...|
|00004c00| 63 61 73 65 20 6d 45 64 | 69 74 3a 09 09 09 09 09 |case mEd|it:.....|
|00004c10| 2f 2a 20 63 61 6c 6c 20 | 53 79 73 74 65 6d 45 64 |/* call |SystemEd|
|00004c20| 69 74 20 66 6f 72 20 44 | 41 20 65 64 69 74 69 6e |it for D|A editin|
|00004c30| 67 20 26 20 4d 75 6c 74 | 69 46 69 6e 64 65 72 20 |g & Mult|iFinder |
|00004c40| 2a 2f 0d 09 09 09 68 61 | 6e 64 6c 65 64 42 79 44 |*/....ha|ndledByD|
|00004c50| 41 20 3d 20 53 79 73 74 | 65 6d 45 64 69 74 28 6d |A = Syst|emEdit(m|
|00004c60| 65 6e 75 49 74 65 6d 2d | 31 29 3b 09 2f 2a 20 73 |enuItem-|1);./* s|
|00004c70| 69 6e 63 65 20 77 65 20 | 64 6f 6e d5 74 20 64 6f |ince we |don.t do|
|00004c80| 20 61 6e 79 20 45 64 69 | 74 69 6e 67 20 2a 2f 0d | any Edi|ting */.|
|00004c90| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00004ca0| 20 6d 4c 69 67 68 74 3a | 0d 09 09 09 73 77 69 74 | mLight:|....swit|
|00004cb0| 63 68 20 28 20 6d 65 6e | 75 49 74 65 6d 20 29 20 |ch ( men|uItem ) |
|00004cc0| 7b 0d 09 09 09 09 63 61 | 73 65 20 69 53 74 6f 70 |{.....ca|se iStop|
|00004cd0| 3a 0d 09 09 09 09 09 53 | 65 74 4c 69 67 68 74 28 |:......S|etLight(|
|00004ce0| 46 72 6f 6e 74 57 69 6e | 64 6f 77 28 29 2c 20 74 |FrontWin|dow(), t|
|00004cf0| 72 75 65 29 3b 0d 09 09 | 09 09 09 62 72 65 61 6b |rue);...|...break|
|00004d00| 3b 0d 09 09 09 09 63 61 | 73 65 20 69 47 6f 3a 0d |;.....ca|se iGo:.|
|00004d10| 09 09 09 09 09 53 65 74 | 4c 69 67 68 74 28 46 72 |.....Set|Light(Fr|
|00004d20| 6f 6e 74 57 69 6e 64 6f | 77 28 29 2c 20 66 61 6c |ontWindo|w(), fal|
|00004d30| 73 65 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |se);....|..break;|
|00004d40| 0d 09 09 09 7d 0d 09 09 | 09 62 72 65 61 6b 3b 0d |....}...|.break;.|
|00004d50| 09 7d 0d 09 48 69 6c 69 | 74 65 4d 65 6e 75 28 30 |.}..Hili|teMenu(0|
|00004d60| 29 3b 09 09 09 09 09 2f | 2a 20 75 6e 68 69 67 68 |);...../|* unhigh|
|00004d70| 6c 69 67 68 74 20 77 68 | 61 74 20 4d 65 6e 75 53 |light wh|at MenuS|
|00004d80| 65 6c 65 63 74 20 28 6f | 72 20 4d 65 6e 75 4b 65 |elect (o|r MenuKe|
|00004d90| 79 29 20 68 69 6c 69 74 | 65 64 20 2a 2f 0d 7d 20 |y) hilit|ed */.} |
|00004da0| 2f 2a 44 6f 4d 65 6e 75 | 43 6f 6d 6d 61 6e 64 2a |/*DoMenu|Command*|
|00004db0| 2f 0d 0d 0d 2f 2a 20 43 | 68 61 6e 67 65 20 74 68 |/.../* C|hange th|
|00004dc0| 65 20 73 65 74 74 69 6e | 67 20 6f 66 20 74 68 65 |e settin|g of the|
|00004dd0| 20 6c 69 67 68 74 2e 20 | 2a 2f 0d 0d 23 64 65 66 | light. |*/..#def|
|00004de0| 69 6e 65 20 5f 5f 53 45 | 47 5f 5f 20 4d 61 69 6e |ine __SE|G__ Main|
|00004df0| 0d 76 6f 69 64 20 53 65 | 74 4c 69 67 68 74 28 20 |.void Se|tLight( |
|00004e00| 77 69 6e 64 6f 77 2c 20 | 6e 65 77 53 74 6f 70 70 |window, |newStopp|
|00004e10| 65 64 20 29 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |ed )..Wi|ndowPtr.|
|00004e20| 77 69 6e 64 6f 77 3b 0d | 09 42 6f 6f 6c 65 61 6e |window;.|.Boolean|
|00004e30| 09 09 6e 65 77 53 74 6f | 70 70 65 64 3b 0d 7b 0d |..newSto|pped;.{.|
|00004e40| 09 69 66 20 28 20 6e 65 | 77 53 74 6f 70 70 65 64 |.if ( ne|wStopped|
|00004e50| 20 21 3d 20 67 53 74 6f | 70 70 65 64 20 29 20 7b | != gSto|pped ) {|
|00004e60| 0d 09 09 67 53 74 6f 70 | 70 65 64 20 3d 20 6e 65 |...gStop|ped = ne|
|00004e70| 77 53 74 6f 70 70 65 64 | 3b 0d 09 09 53 65 74 50 |wStopped|;...SetP|
|00004e80| 6f 72 74 28 77 69 6e 64 | 6f 77 29 3b 0d 09 09 49 |ort(wind|ow);...I|
|00004e90| 6e 76 61 6c 52 65 63 74 | 28 26 77 69 6e 64 6f 77 |nvalRect|(&window|
|00004ea0| 2d 3e 70 6f 72 74 52 65 | 63 74 29 3b 0d 09 7d 0d |->portRe|ct);..}.|
|00004eb0| 7d 20 2f 2a 53 65 74 4c | 69 67 68 74 2a 2f 0d 0d |} /*SetL|ight*/..|
|00004ec0| 0d 2f 2a 20 43 6c 6f 73 | 65 20 61 20 77 69 6e 64 |./* Clos|e a wind|
|00004ed0| 6f 77 2e 20 54 68 69 73 | 20 68 61 6e 64 6c 65 73 |ow. This| handles|
|00004ee0| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 79 20 | desk ac|cessory |
|00004ef0| 61 6e 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |and appl|ication |
|00004f00| 77 69 6e 64 6f 77 73 2e | 20 2a 2f 0d 0d 2f 2a 09 |windows.| */../*.|
|00004f10| 31 2e 30 31 20 2d 20 41 | 74 20 74 68 69 73 20 70 |1.01 - A|t this p|
|00004f20| 6f 69 6e 74 2c 20 69 66 | 20 74 68 65 72 65 20 77 |oint, if| there w|
|00004f30| 61 73 20 61 20 64 6f 63 | 75 6d 65 6e 74 20 61 73 |as a doc|ument as|
|00004f40| 73 6f 63 69 61 74 65 64 | 20 77 69 74 68 20 61 0d |sociated| with a.|
|00004f50| 09 77 69 6e 64 6f 77 2c | 20 79 6f 75 20 63 6f 75 |.window,| you cou|
|00004f60| 6c 64 20 64 6f 20 61 6e | 79 20 64 6f 63 75 6d 65 |ld do an|y docume|
|00004f70| 6e 74 20 73 61 76 69 6e | 67 20 70 72 6f 63 65 73 |nt savin|g proces|
|00004f80| 73 69 6e 67 20 69 66 20 | 69 74 20 69 73 20 27 64 |sing if |it is 'd|
|00004f90| 69 72 74 79 27 2e 0d 09 | 44 6f 43 6c 6f 73 65 57 |irty'...|DoCloseW|
|00004fa0| 69 6e 64 6f 77 20 77 6f | 75 6c 64 20 72 65 74 75 |indow wo|uld retu|
|00004fb0| 72 6e 20 74 72 75 65 20 | 69 66 20 74 68 65 20 77 |rn true |if the w|
|00004fc0| 69 6e 64 6f 77 20 61 63 | 74 75 61 6c 6c 79 20 63 |indow ac|tually c|
|00004fd0| 6c 6f 73 65 64 2c 20 69 | 2e 65 2e 2c 0d 09 74 68 |losed, i|.e.,..th|
|00004fe0| 65 20 75 73 65 72 20 64 | 69 64 6e d5 74 20 63 61 |e user d|idn.t ca|
|00004ff0| 6e 63 65 6c 20 66 72 6f | 6d 20 61 20 73 61 76 65 |ncel fro|m a save|
|00005000| 20 64 69 61 6c 6f 67 2e | 20 54 68 69 73 20 72 65 | dialog.| This re|
|00005010| 73 75 6c 74 20 69 73 20 | 68 61 6e 64 79 20 77 68 |sult is |handy wh|
|00005020| 65 6e 0d 09 74 68 65 20 | 75 73 65 72 20 71 75 69 |en..the |user qui|
|00005030| 74 73 20 61 6e 20 61 70 | 70 6c 69 63 61 74 69 6f |ts an ap|plicatio|
|00005040| 6e 2c 20 62 75 74 20 74 | 68 65 6e 20 63 61 6e 63 |n, but t|hen canc|
|00005050| 65 6c 73 20 74 68 65 20 | 73 61 76 65 20 6f 66 20 |els the |save of |
|00005060| 61 20 64 6f 63 75 6d 65 | 6e 74 0d 09 61 73 73 6f |a docume|nt..asso|
|00005070| 63 69 61 74 65 64 20 77 | 69 74 68 20 61 20 77 69 |ciated w|ith a wi|
|00005080| 6e 64 6f 77 2e 20 2a 2f | 0d 0d 23 64 65 66 69 6e |ndow. */|..#defin|
|00005090| 65 20 5f 5f 53 45 47 5f | 5f 20 4d 61 69 6e 0d 42 |e __SEG_|_ Main.B|
|000050a0| 6f 6f 6c 65 61 6e 20 44 | 6f 43 6c 6f 73 65 57 69 |oolean D|oCloseWi|
|000050b0| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 0d 09 57 69 |ndow(win|dow)..Wi|
|000050c0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|000050d0| 7b 0d 09 69 66 20 28 20 | 49 73 44 41 57 69 6e 64 |{..if ( |IsDAWind|
|000050e0| 6f 77 28 77 69 6e 64 6f | 77 29 20 29 0d 09 09 43 |ow(windo|w) )...C|
|000050f0| 6c 6f 73 65 44 65 73 6b | 41 63 63 28 28 28 57 69 |loseDesk|Acc(((Wi|
|00005100| 6e 64 6f 77 50 65 65 6b | 29 20 77 69 6e 64 6f 77 |ndowPeek|) window|
|00005110| 29 2d 3e 77 69 6e 64 6f | 77 4b 69 6e 64 29 3b 0d |)->windo|wKind);.|
|00005120| 09 65 6c 73 65 20 69 66 | 20 28 20 49 73 41 70 70 |.else if| ( IsApp|
|00005130| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 29 |Window(w|indow) )|
|00005140| 0d 09 09 43 6c 6f 73 65 | 57 69 6e 64 6f 77 28 77 |...Close|Window(w|
|00005150| 69 6e 64 6f 77 29 3b 0d | 09 72 65 74 75 72 6e 20 |indow);.|.return |
|00005160| 74 72 75 65 3b 0d 7d 20 | 2f 2a 44 6f 43 6c 6f 73 |true;.} |/*DoClos|
|00005170| 65 57 69 6e 64 6f 77 2a | 2f 0d 0d 0d 2f 2a 2a 2a |eWindow*|/.../***|
|00005180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051d0| 2a 2a 2a 0d 2a 2a 2a 20 | 31 2e 30 31 20 44 6f 43 |***.*** |1.01 DoC|
|000051e0| 6c 6f 73 65 42 65 68 69 | 6e 64 28 77 69 6e 64 6f |loseBehi|nd(windo|
|000051f0| 77 29 20 77 61 73 20 72 | 65 6d 6f 76 65 64 20 2a |w) was r|emoved *|
|00005200| 2a 2a 0d 0d 09 31 2e 30 | 31 20 2d 20 44 6f 43 6c |**...1.0|1 - DoCl|
|00005210| 6f 73 65 42 65 68 69 6e | 64 20 77 61 73 20 61 20 |oseBehin|d was a |
|00005220| 67 6f 6f 64 20 69 64 65 | 61 20 66 6f 72 20 63 6c |good ide|a for cl|
|00005230| 6f 73 69 6e 67 20 77 69 | 6e 64 6f 77 73 20 77 68 |osing wi|ndows wh|
|00005240| 65 6e 20 71 75 69 74 74 | 69 6e 67 0d 09 61 6e 64 |en quitt|ing..and|
|00005250| 20 6e 6f 74 20 68 61 76 | 69 6e 67 20 74 6f 20 77 | not hav|ing to w|
|00005260| 6f 72 72 79 20 61 62 6f | 75 74 20 75 70 64 61 74 |orry abo|ut updat|
|00005270| 69 6e 67 20 74 68 65 20 | 77 69 6e 64 6f 77 73 2c |ing the |windows,|
|00005280| 20 62 75 74 20 69 74 20 | 73 75 66 66 65 72 65 64 | but it |suffered|
|00005290| 0d 09 66 72 6f 6d 20 61 | 20 66 61 74 61 6c 20 66 |..from a| fatal f|
|000052a0| 6c 61 77 2e 20 49 66 20 | 61 20 64 65 73 6b 20 61 |law. If |a desk a|
|000052b0| 63 63 65 73 73 6f 72 79 | 20 6f 77 6e 65 64 20 74 |ccessory| owned t|
|000052c0| 77 6f 20 77 69 6e 64 6f | 77 73 2c 20 69 74 20 77 |wo windo|ws, it w|
|000052d0| 6f 75 6c 64 0d 09 63 6c | 6f 73 65 20 62 6f 74 68 |ould..cl|ose both|
|000052e0| 20 74 68 6f 73 65 20 77 | 69 6e 64 6f 77 73 20 77 | those w|indows w|
|000052f0| 68 65 6e 20 43 6c 6f 73 | 65 44 65 73 6b 41 63 63 |hen Clos|eDeskAcc|
|00005300| 20 77 61 73 20 63 61 6c | 6c 65 64 2e 20 57 68 65 | was cal|led. Whe|
|00005310| 6e 20 44 6f 43 6c 6f 73 | 65 42 65 68 69 6e 64 0d |n DoClos|eBehind.|
|00005320| 09 67 6f 74 20 61 72 6f | 75 6e 64 20 74 6f 20 63 |.got aro|und to c|
|00005330| 61 6c 6c 69 6e 67 20 44 | 6f 43 6c 6f 73 65 57 69 |alling D|oCloseWi|
|00005340| 6e 64 6f 77 20 66 6f 72 | 20 74 68 61 74 20 6f 74 |ndow for| that ot|
|00005350| 68 65 72 20 77 69 6e 64 | 6f 77 20 74 68 61 74 20 |her wind|ow that |
|00005360| 77 61 73 20 61 6c 72 65 | 61 64 79 0d 09 63 6c 6f |was alre|ady..clo|
|00005370| 73 65 64 2c 20 74 68 69 | 6e 67 73 20 77 6f 75 6c |sed, thi|ngs woul|
|00005380| 64 20 67 6f 20 76 65 72 | 79 20 70 6f 6f 72 6c 79 |d go ver|y poorly|
|00005390| 2e 20 41 6e 6f 74 68 65 | 72 20 6f 70 74 69 6f 6e |. Anothe|r option|
|000053a0| 20 77 6f 75 6c 64 20 62 | 65 20 74 6f 20 68 61 76 | would b|e to hav|
|000053b0| 65 20 61 0d 09 70 72 6f | 63 65 64 75 72 65 2c 20 |e a..pro|cedure, |
|000053c0| 47 65 74 52 65 61 72 57 | 69 6e 64 6f 77 2c 20 74 |GetRearW|indow, t|
|000053d0| 68 61 74 20 77 6f 75 6c | 64 20 67 6f 20 74 68 72 |hat woul|d go thr|
|000053e0| 6f 75 67 68 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |ough the| window |
|000053f0| 6c 69 73 74 20 61 6e 64 | 20 72 65 74 75 72 6e 0d |list and| return.|
|00005400| 09 74 68 65 20 6c 61 73 | 74 20 77 69 6e 64 6f 77 |.the las|t window|
|00005410| 2e 20 49 6e 73 74 65 61 | 64 2c 20 77 65 20 64 65 |. Instea|d, we de|
|00005420| 63 69 64 65 64 20 74 6f | 20 70 72 65 73 65 6e 74 |cided to| present|
|00005430| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 61 70 | the sta|ndard ap|
|00005440| 70 72 6f 61 63 68 0d 09 | 6f 66 20 67 65 74 74 69 |proach..|of getti|
|00005450| 6e 67 20 61 6e 64 20 63 | 6c 6f 73 69 6e 67 20 46 |ng and c|losing F|
|00005460| 72 6f 6e 74 57 69 6e 64 | 6f 77 20 75 6e 74 69 6c |rontWind|ow until|
|00005470| 20 46 72 6f 6e 74 57 69 | 6e 64 6f 77 20 72 65 74 | FrontWi|ndow ret|
|00005480| 75 72 6e 73 20 4e 49 4c | 2e 20 54 68 69 73 0d 09 |urns NIL|. This..|
|00005490| 68 61 73 20 61 20 70 6f | 74 65 6e 74 69 61 6c 20 |has a po|tential |
|000054a0| 62 65 6e 65 66 69 74 20 | 69 6e 20 74 68 61 74 20 |benefit |in that |
|000054b0| 74 68 65 20 77 69 6e 64 | 6f 77 20 77 68 6f 73 65 |the wind|ow whose|
|000054c0| 20 64 6f 63 75 6d 65 6e | 74 20 6e 65 65 64 73 20 | documen|t needs |
|000054d0| 74 6f 20 62 65 20 73 61 | 76 65 64 0d 09 6d 61 79 |to be sa|ved..may|
|000054e0| 20 62 65 20 76 69 73 69 | 62 6c 65 20 73 69 6e 63 | be visi|ble sinc|
|000054f0| 65 20 69 74 20 69 73 20 | 74 68 65 20 66 72 6f 6e |e it is |the fron|
|00005500| 74 20 77 69 6e 64 6f 77 | 2c 20 74 68 65 72 65 66 |t window|, theref|
|00005510| 6f 72 65 20 64 65 63 72 | 65 61 73 69 6e 67 20 74 |ore decr|easing t|
|00005520| 68 65 0d 09 63 68 61 6e | 63 65 20 6f 66 20 75 73 |he..chan|ce of us|
|00005530| 65 72 20 63 6f 6e 66 75 | 73 69 6f 6e 2e 20 46 6f |er confu|sion. Fo|
|00005540| 72 20 61 65 73 74 68 65 | 74 69 63 20 72 65 61 73 |r aesthe|tic reas|
|00005550| 6f 6e 73 2c 20 74 68 65 | 20 77 69 6e 64 6f 77 73 |ons, the| windows|
|00005560| 20 69 6e 20 74 68 65 0d | 09 61 70 70 6c 69 63 61 | in the.|.applica|
|00005570| 74 69 6f 6e 20 73 68 6f | 75 6c 64 20 62 65 20 63 |tion sho|uld be c|
|00005580| 68 65 63 6b 65 64 20 66 | 6f 72 20 75 70 64 61 74 |hecked f|or updat|
|00005590| 65 73 20 70 65 72 69 6f | 64 69 63 61 6c 6c 79 20 |es perio|dically |
|000055a0| 61 6e 64 20 68 61 76 65 | 20 74 68 65 0d 09 75 70 |and have| the..up|
|000055b0| 64 61 74 65 73 20 73 65 | 72 76 69 63 65 64 2e 0d |dates se|rviced..|
|000055c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005600| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005610| 2a 2a 2a 2a 2a 2a 2f 0d | 0d 0d 2f 2a 20 43 6c 65 |******/.|../* Cle|
|00005620| 61 6e 20 75 70 20 74 68 | 65 20 61 70 70 6c 69 63 |an up th|e applic|
|00005630| 61 74 69 6f 6e 20 61 6e | 64 20 65 78 69 74 2e 20 |ation an|d exit. |
|00005640| 57 65 20 63 6c 6f 73 65 | 20 61 6c 6c 20 6f 66 20 |We close| all of |
|00005650| 74 68 65 20 77 69 6e 64 | 6f 77 73 20 73 6f 20 74 |the wind|ows so t|
|00005660| 68 61 74 0d 20 74 68 65 | 79 20 63 61 6e 20 75 70 |hat. the|y can up|
|00005670| 64 61 74 65 20 74 68 65 | 69 72 20 64 6f 63 75 6d |date the|ir docum|
|00005680| 65 6e 74 73 2c 20 69 66 | 20 61 6e 79 2e 20 2a 2f |ents, if| any. */|
|00005690| 0d 20 0d 2f 2a 09 31 2e | 30 31 20 2d 20 49 66 20 |. ./*.1.|01 - If |
|000056a0| 77 65 20 66 69 6e 64 20 | 6f 75 74 20 74 68 61 74 |we find |out that|
|000056b0| 20 61 20 63 61 6e 63 65 | 6c 20 68 61 73 20 6f 63 | a cance|l has oc|
|000056c0| 63 75 72 72 65 64 2c 20 | 77 65 20 77 6f 6e 27 74 |curred, |we won't|
|000056d0| 20 65 78 69 74 20 74 6f | 20 74 68 65 0d 09 73 68 | exit to| the..sh|
|000056e0| 65 6c 6c 2c 20 62 75 74 | 20 77 69 6c 6c 20 72 65 |ell, but| will re|
|000056f0| 74 75 72 6e 20 69 6e 73 | 74 65 61 64 2e 20 2a 2f |turn ins|tead. */|
|00005700| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|00005710| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 54 65 72 6d |_ Main.v|oid Term|
|00005720| 69 6e 61 74 65 28 29 0d | 7b 0d 09 57 69 6e 64 6f |inate().|{..Windo|
|00005730| 77 50 74 72 09 61 57 69 | 6e 64 6f 77 3b 0d 09 42 |wPtr.aWi|ndow;..B|
|00005740| 6f 6f 6c 65 61 6e 09 09 | 63 6c 6f 73 65 64 3b 0d |oolean..|closed;.|
|00005750| 09 0d 09 63 6c 6f 73 65 | 64 20 3d 20 74 72 75 65 |...close|d = true|
|00005760| 3b 0d 09 64 6f 20 7b 0d | 09 09 61 57 69 6e 64 6f |;..do {.|..aWindo|
|00005770| 77 20 3d 20 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 |w = Fron|tWindow(|
|00005780| 29 3b 09 09 09 09 2f 2a | 20 67 65 74 20 74 68 65 |);..../*| get the|
|00005790| 20 63 75 72 72 65 6e 74 | 20 66 72 6f 6e 74 20 77 | current| front w|
|000057a0| 69 6e 64 6f 77 20 2a 2f | 0d 09 09 69 66 20 28 61 |indow */|...if (a|
|000057b0| 57 69 6e 64 6f 77 20 21 | 3d 20 6e 69 6c 29 0d 09 |Window !|= nil)..|
|000057c0| 09 09 63 6c 6f 73 65 64 | 20 3d 20 44 6f 43 6c 6f |..closed| = DoClo|
|000057d0| 73 65 57 69 6e 64 6f 77 | 28 61 57 69 6e 64 6f 77 |seWindow|(aWindow|
|000057e0| 29 3b 09 2f 2a 20 63 6c | 6f 73 65 20 74 68 69 73 |);./* cl|ose this|
|000057f0| 20 77 69 6e 64 6f 77 20 | 2a 2f 09 0d 09 7d 0d 09 | window |*/...}..|
|00005800| 77 68 69 6c 65 20 28 63 | 6c 6f 73 65 64 20 26 26 |while (c|losed &&|
|00005810| 20 28 61 57 69 6e 64 6f | 77 20 21 3d 20 6e 69 6c | (aWindo|w != nil|
|00005820| 29 29 3b 0d 09 69 66 20 | 28 63 6c 6f 73 65 64 29 |));..if |(closed)|
|00005830| 0d 09 09 45 78 69 74 54 | 6f 53 68 65 6c 6c 28 29 |...ExitT|oShell()|
|00005840| 3b 09 09 09 09 09 09 09 | 2f 2a 20 65 78 69 74 20 |;.......|/* exit |
|00005850| 69 66 20 6e 6f 20 63 61 | 6e 63 65 6c 6c 61 74 69 |if no ca|ncellati|
|00005860| 6f 6e 20 2a 2f 0d 7d 20 | 2f 2a 54 65 72 6d 69 6e |on */.} |/*Termin|
|00005870| 61 74 65 2a 2f 0d 0d 0d | 2f 2a 09 53 65 74 20 75 |ate*/...|/*.Set u|
|00005880| 70 20 74 68 65 20 77 68 | 6f 6c 65 20 77 6f 72 6c |p the wh|ole worl|
|00005890| 64 2c 20 69 6e 63 6c 75 | 64 69 6e 67 20 67 6c 6f |d, inclu|ding glo|
|000058a0| 62 61 6c 20 76 61 72 69 | 61 62 6c 65 73 2c 20 54 |bal vari|ables, T|
|000058b0| 6f 6f 6c 62 6f 78 20 6d | 61 6e 61 67 65 72 73 2c |oolbox m|anagers,|
|000058c0| 0d 09 61 6e 64 20 6d 65 | 6e 75 73 2e 20 57 65 20 |..and me|nus. We |
|000058d0| 61 6c 73 6f 20 63 72 65 | 61 74 65 20 6f 75 72 20 |also cre|ate our |
|000058e0| 6f 6e 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |one appl|ication |
|000058f0| 77 69 6e 64 6f 77 20 61 | 74 20 74 68 69 73 20 74 |window a|t this t|
|00005900| 69 6d 65 2e 0d 09 53 69 | 6e 63 65 20 77 69 6e 64 |ime...Si|nce wind|
|00005910| 6f 77 20 73 74 6f 72 61 | 67 65 20 69 73 20 6e 6f |ow stora|ge is no|
|00005920| 6e 2d 72 65 6c 6f 63 61 | 74 65 61 62 6c 65 2c 20 |n-reloca|teable, |
|00005930| 68 6f 77 20 61 6e 64 20 | 77 68 65 6e 20 74 6f 20 |how and |when to |
|00005940| 61 6c 6c 6f 63 61 74 65 | 20 73 70 61 63 65 0d 09 |allocate| space..|
|00005950| 66 6f 72 20 77 69 6e 64 | 6f 77 73 20 69 73 20 76 |for wind|ows is v|
|00005960| 65 72 79 20 69 6d 70 6f | 72 74 61 6e 74 20 73 6f |ery impo|rtant so|
|00005970| 20 74 68 61 74 20 68 65 | 61 70 20 66 72 61 67 6d | that he|ap fragm|
|00005980| 65 6e 74 61 74 69 6f 6e | 20 64 6f 65 73 20 6e 6f |entation| does no|
|00005990| 74 20 6f 63 63 75 72 2e | 0d 09 42 65 63 61 75 73 |t occur.|..Becaus|
|000059a0| 65 20 53 61 6d 70 6c 65 | 20 68 61 73 20 6f 6e 6c |e Sample| has onl|
|000059b0| 79 20 6f 6e 65 20 77 69 | 6e 64 6f 77 20 61 6e 64 |y one wi|ndow and|
|000059c0| 20 69 74 20 69 73 20 6f | 6e 6c 79 20 64 69 73 70 | it is o|nly disp|
|000059d0| 6f 73 65 64 20 77 68 65 | 6e 20 74 68 65 20 61 70 |osed whe|n the ap|
|000059e0| 70 6c 69 63 61 74 69 6f | 6e 0d 09 71 75 69 74 73 |plicatio|n..quits|
|000059f0| 2c 20 77 65 20 77 69 6c | 6c 20 61 6c 6c 6f 63 61 |, we wil|l alloca|
|00005a00| 74 65 20 69 74 73 20 73 | 70 61 63 65 20 68 65 72 |te its s|pace her|
|00005a10| 65 2c 20 62 65 66 6f 72 | 65 20 61 6e 79 74 68 69 |e, befor|e anythi|
|00005a20| 6e 67 20 74 68 61 74 20 | 6d 69 67 68 74 20 62 65 |ng that |might be|
|00005a30| 20 61 20 6c 6f 63 6b 65 | 64 0d 09 72 65 6c 6f 63 | a locke|d..reloc|
|00005a40| 61 74 61 62 6c 65 20 6f | 62 6a 65 63 74 20 67 65 |atable o|bject ge|
|00005a50| 74 73 20 69 6e 74 6f 20 | 74 68 65 20 68 65 61 70 |ts into |the heap|
|00005a60| 2e 20 54 68 69 73 20 77 | 61 79 2c 20 77 65 20 63 |. This w|ay, we c|
|00005a70| 61 6e 20 66 6f 72 63 65 | 20 74 68 65 20 73 74 6f |an force| the sto|
|00005a80| 72 61 67 65 20 74 6f 20 | 62 65 0d 09 69 6e 20 74 |rage to |be..in t|
|00005a90| 68 65 20 6c 6f 77 65 73 | 74 20 6d 65 6d 6f 72 79 |he lowes|t memory|
|00005aa0| 20 61 76 61 69 6c 61 62 | 6c 65 20 69 6e 20 74 68 | availab|le in th|
|00005ab0| 65 20 68 65 61 70 2e 20 | 57 69 6e 64 6f 77 20 73 |e heap. |Window s|
|00005ac0| 74 6f 72 61 67 65 20 63 | 61 6e 20 64 69 66 66 65 |torage c|an diffe|
|00005ad0| 72 20 77 69 64 65 6c 79 | 0d 09 61 6d 6f 6e 67 73 |r widely|..amongs|
|00005ae0| 74 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 64 |t applic|ations d|
|00005af0| 65 70 65 6e 64 69 6e 67 | 20 6f 6e 20 68 6f 77 20 |epending| on how |
|00005b00| 6d 61 6e 79 20 77 69 6e | 64 6f 77 73 20 61 72 65 |many win|dows are|
|00005b10| 20 63 72 65 61 74 65 64 | 20 61 6e 64 20 64 69 73 | created| and dis|
|00005b20| 70 6f 73 65 64 2e 20 2a | 2f 0d 0d 2f 2a 09 31 2e |posed. *|/../*.1.|
|00005b30| 30 31 20 2d 20 54 68 65 | 20 63 6f 64 65 20 74 68 |01 - The| code th|
|00005b40| 61 74 20 75 73 65 64 20 | 74 6f 20 62 65 20 70 61 |at used |to be pa|
|00005b50| 72 74 20 6f 66 20 46 6f | 72 63 65 45 6e 76 69 72 |rt of Fo|rceEnvir|
|00005b60| 6f 6e 73 20 68 61 73 20 | 62 65 65 6e 20 6d 6f 76 |ons has |been mov|
|00005b70| 65 64 20 69 6e 74 6f 0d | 09 74 68 69 73 20 6d 6f |ed into.|.this mo|
|00005b80| 64 75 6c 65 2e 20 49 66 | 20 61 6e 20 65 72 72 6f |dule. If| an erro|
|00005b90| 72 20 69 73 20 64 65 74 | 65 63 74 65 64 2c 20 69 |r is det|ected, i|
|00005ba0| 6e 73 74 65 61 64 20 6f | 66 20 6d 65 72 65 6c 79 |nstead o|f merely|
|00005bb0| 20 64 6f 69 6e 67 20 61 | 6e 20 45 78 69 74 54 6f | doing a|n ExitTo|
|00005bc0| 53 68 65 6c 6c 2c 0d 09 | 77 68 69 63 68 20 6c 65 |Shell,..|which le|
|00005bd0| 61 76 65 73 20 74 68 65 | 20 75 73 65 72 20 77 69 |aves the| user wi|
|00005be0| 74 68 6f 75 74 20 6d 75 | 63 68 20 74 6f 20 67 6f |thout mu|ch to go|
|00005bf0| 20 6f 6e 2c 20 77 65 20 | 63 61 6c 6c 20 41 6c 65 | on, we |call Ale|
|00005c00| 72 74 55 73 65 72 2c 20 | 77 68 69 63 68 20 70 75 |rtUser, |which pu|
|00005c10| 74 73 0d 09 75 70 20 61 | 20 73 69 6d 70 6c 65 20 |ts..up a| simple |
|00005c20| 61 6c 65 72 74 20 74 68 | 61 74 20 6a 75 73 74 20 |alert th|at just |
|00005c30| 73 61 79 73 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |says an |error oc|
|00005c40| 63 75 72 72 65 64 20 61 | 6e 64 20 74 68 65 6e 20 |curred a|nd then |
|00005c50| 63 61 6c 6c 73 20 45 78 | 69 74 54 6f 53 68 65 6c |calls Ex|itToShel|
|00005c60| 6c 2e 0d 09 53 69 6e 63 | 65 20 74 68 65 72 65 20 |l...Sinc|e there |
|00005c70| 69 73 20 6e 6f 20 6f 74 | 68 65 72 20 63 6c 65 61 |is no ot|her clea|
|00005c80| 6e 75 70 20 6e 65 65 64 | 65 64 20 61 74 20 74 68 |nup need|ed at th|
|00005c90| 69 73 20 70 6f 69 6e 74 | 20 69 66 20 61 6e 20 65 |is point| if an e|
|00005ca0| 72 72 6f 72 20 69 73 20 | 64 65 74 65 63 74 65 64 |rror is |detected|
|00005cb0| 2c 0d 09 74 68 69 73 20 | 66 6f 72 6d 20 6f 66 20 |,..this |form of |
|00005cc0| 65 72 72 6f 72 2d 20 68 | 61 6e 64 6c 69 6e 67 20 |error- h|andling |
|00005cd0| 69 73 20 61 63 63 65 70 | 74 61 62 6c 65 2e 20 49 |is accep|table. I|
|00005ce0| 66 20 6d 6f 72 65 20 73 | 6f 70 68 69 73 74 69 63 |f more s|ophistic|
|00005cf0| 61 74 65 64 20 65 72 72 | 6f 72 20 72 65 63 6f 76 |ated err|or recov|
|00005d00| 65 72 79 0d 09 69 73 20 | 6e 65 65 64 65 64 2c 20 |ery..is |needed, |
|00005d10| 61 6e 20 65 78 63 65 70 | 74 69 6f 6e 20 6d 65 63 |an excep|tion mec|
|00005d20| 68 61 6e 69 73 6d 2c 20 | 73 75 63 68 20 61 73 20 |hanism, |such as |
|00005d30| 69 73 20 70 72 6f 76 69 | 64 65 64 20 62 79 20 53 |is provi|ded by S|
|00005d40| 69 67 6e 61 6c 73 2c 20 | 63 61 6e 20 62 65 20 75 |ignals, |can be u|
|00005d50| 73 65 64 2e 20 2a 2f 0d | 0d 23 64 65 66 69 6e 65 |sed. */.|.#define|
|00005d60| 20 5f 5f 53 45 47 5f 5f | 20 49 6e 69 74 69 61 6c | __SEG__| Initial|
|00005d70| 69 7a 65 0d 76 6f 69 64 | 20 49 6e 69 74 69 61 6c |ize.void| Initial|
|00005d80| 69 7a 65 28 29 0d 7b 0d | 09 48 61 6e 64 6c 65 09 |ize().{.|.Handle.|
|00005d90| 09 6d 65 6e 75 42 61 72 | 3b 0d 09 57 69 6e 64 6f |.menuBar|;..Windo|
|00005da0| 77 50 74 72 09 77 69 6e | 64 6f 77 3b 0d 09 6c 6f |wPtr.win|dow;..lo|
|00005db0| 6e 67 09 09 74 6f 74 61 | 6c 2c 20 63 6f 6e 74 69 |ng..tota|l, conti|
|00005dc0| 67 3b 0d 09 45 76 65 6e | 74 52 65 63 6f 72 64 20 |g;..Even|tRecord |
|00005dd0| 65 76 65 6e 74 3b 0d 09 | 73 68 6f 72 74 09 09 63 |event;..|short..c|
|00005de0| 6f 75 6e 74 3b 0d 0d 09 | 67 48 61 73 57 61 69 74 |ount;...|gHasWait|
|00005df0| 4e 65 78 74 45 76 65 6e | 74 20 3d 20 54 72 61 70 |NextEven|t = Trap|
|00005e00| 41 76 61 69 6c 61 62 6c | 65 28 5f 57 61 69 74 4e |Availabl|e(_WaitN|
|00005e10| 65 78 74 45 76 65 6e 74 | 2c 20 54 6f 6f 6c 54 72 |extEvent|, ToolTr|
|00005e20| 61 70 29 3b 0d 09 67 49 | 6e 42 61 63 6b 67 72 6f |ap);..gI|nBackgro|
|00005e30| 75 6e 64 20 3d 20 66 61 | 6c 73 65 3b 0d 0d 09 49 |und = fa|lse;...I|
|00005e40| 6e 69 74 47 72 61 66 28 | 28 50 74 72 29 20 26 71 |nitGraf(|(Ptr) &q|
|00005e50| 64 2e 74 68 65 50 6f 72 | 74 29 3b 0d 09 49 6e 69 |d.thePor|t);..Ini|
|00005e60| 74 46 6f 6e 74 73 28 29 | 3b 0d 09 49 6e 69 74 57 |tFonts()|;..InitW|
|00005e70| 69 6e 64 6f 77 73 28 29 | 3b 0d 09 49 6e 69 74 4d |indows()|;..InitM|
|00005e80| 65 6e 75 73 28 29 3b 0d | 09 54 45 49 6e 69 74 28 |enus();.|.TEInit(|
|00005e90| 29 3b 0d 09 49 6e 69 74 | 44 69 61 6c 6f 67 73 28 |);..Init|Dialogs(|
|00005ea0| 6e 69 6c 29 3b 0d 09 49 | 6e 69 74 43 75 72 73 6f |nil);..I|nitCurso|
|00005eb0| 72 28 29 3b 0d 09 0d 09 | 2f 2a 09 43 61 6c 6c 20 |r();....|/*.Call |
|00005ec0| 4d 50 50 4f 70 65 6e 20 | 61 6e 64 20 41 54 50 4c |MPPOpen |and ATPL|
|00005ed0| 6f 61 64 20 61 74 20 74 | 68 69 73 20 70 6f 69 6e |oad at t|his poin|
|00005ee0| 74 20 74 6f 20 69 6e 69 | 74 69 61 6c 69 7a 65 20 |t to ini|tialize |
|00005ef0| 41 70 70 6c 65 54 61 6c | 6b 2c 0d 09 20 09 69 66 |AppleTal|k,.. .if|
|00005f00| 20 79 6f 75 20 61 72 65 | 20 75 73 69 6e 67 20 69 | you are| using i|
|00005f10| 74 2e 20 2a 2f 0d 09 2f | 2a 09 4e 4f 54 45 20 2d |t. */../|*.NOTE -|
|00005f20| 2d 20 49 74 20 69 73 20 | 6e 6f 20 6c 6f 6e 67 65 |- It is |no longe|
|00005f30| 72 20 6e 65 63 65 73 73 | 61 72 79 2c 20 61 6e 64 |r necess|ary, and|
|00005f40| 20 61 63 74 75 61 6c 6c | 79 20 75 6e 68 65 61 6c | actuall|y unheal|
|00005f50| 74 68 79 2c 20 74 6f 20 | 63 68 65 63 6b 0d 09 09 |thy, to |check...|
|00005f60| 50 6f 72 74 42 55 73 65 | 20 61 6e 64 20 53 50 43 |PortBUse| and SPC|
|00005f70| 6f 6e 66 69 67 20 62 65 | 66 6f 72 65 20 6f 70 65 |onfig be|fore ope|
|00005f80| 6e 69 6e 67 20 41 70 70 | 6c 65 54 61 6c 6b 2e 20 |ning App|leTalk. |
|00005f90| 54 68 65 20 64 72 69 76 | 65 72 73 20 61 72 65 20 |The driv|ers are |
|00005fa0| 63 61 70 61 62 6c 65 0d | 09 09 6f 66 20 63 68 65 |capable.|..of che|
|00005fb0| 63 6b 69 6e 67 20 66 6f | 72 20 70 6f 72 74 20 61 |cking fo|r port a|
|00005fc0| 76 61 69 6c 61 62 69 6c | 69 74 79 20 74 68 65 6d |vailabil|ity them|
|00005fd0| 73 65 6c 76 65 73 2e 20 | 2a 2f 0d 09 0d 09 2f 2a |selves. |*/..../*|
|00005fe0| 09 54 68 69 73 20 6e 65 | 78 74 20 62 69 74 20 6f |.This ne|xt bit o|
|00005ff0| 66 20 63 6f 64 65 20 69 | 73 20 6e 65 63 65 73 73 |f code i|s necess|
|00006000| 61 72 79 20 74 6f 20 61 | 6c 6c 6f 77 20 74 68 65 |ary to a|llow the|
|00006010| 20 64 65 66 61 75 6c 74 | 20 62 75 74 74 6f 6e 20 | default| button |
|00006020| 6f 66 20 6f 75 72 0d 09 | 09 61 6c 65 72 74 20 62 |of our..|.alert b|
|00006030| 65 20 6f 75 74 6c 69 6e | 65 64 2e 20 2a 2f 0d 09 |e outlin|ed. */..|
|00006040| 20 0d 09 66 6f 72 20 28 | 63 6f 75 6e 74 20 3d 20 | ..for (|count = |
|00006050| 31 3b 20 63 6f 75 6e 74 | 20 3c 3d 20 33 3b 20 63 |1; count| <= 3; c|
|00006060| 6f 75 6e 74 2b 2b 29 0d | 09 09 47 65 74 4e 65 78 |ount++).|..GetNex|
|00006070| 74 45 76 65 6e 74 28 65 | 76 65 72 79 45 76 65 6e |tEvent(e|veryEven|
|00006080| 74 2c 20 26 65 76 65 6e | 74 29 3b 0d 09 0d 09 2f |t, &even|t);..../|
|00006090| 2a 09 49 67 6e 6f 72 65 | 20 74 68 65 20 65 72 72 |*.Ignore| the err|
|000060a0| 6f 72 20 72 65 74 75 72 | 6e 65 64 20 66 72 6f 6d |or retur|ned from|
|000060b0| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 3b 20 65 76 | SysEnvi|rons; ev|
|000060c0| 65 6e 20 69 66 20 61 6e | 20 65 72 72 6f 72 20 6f |en if an| error o|
|000060d0| 63 63 75 72 72 65 64 2c | 0d 09 09 74 68 65 20 53 |ccurred,|...the S|
|000060e0| 79 73 45 6e 76 69 72 6f | 6e 73 20 67 6c 75 65 20 |ysEnviro|ns glue |
|000060f0| 77 69 6c 6c 20 66 69 6c | 6c 20 69 6e 20 74 68 65 |will fil|l in the|
|00006100| 20 53 79 73 45 6e 76 52 | 65 63 2e 20 59 6f 75 20 | SysEnvR|ec. You |
|00006110| 63 61 6e 20 73 61 76 65 | 20 61 20 72 65 64 75 6e |can save| a redun|
|00006120| 64 61 6e 74 0d 09 09 63 | 61 6c 6c 20 74 6f 20 53 |dant...c|all to S|
|00006130| 79 73 45 6e 76 69 72 6f | 6e 73 20 62 79 20 63 61 |ysEnviro|ns by ca|
|00006140| 6c 6c 69 6e 67 20 69 74 | 20 61 66 74 65 72 20 69 |lling it| after i|
|00006150| 6e 69 74 69 61 6c 69 7a | 69 6e 67 20 41 70 70 6c |nitializ|ing Appl|
|00006160| 65 54 61 6c 6b 2e 20 2a | 2f 0d 09 20 0d 09 53 79 |eTalk. *|/.. ..Sy|
|00006170| 73 45 6e 76 69 72 6f 6e | 73 28 6b 53 79 73 45 6e |sEnviron|s(kSysEn|
|00006180| 76 69 72 6f 6e 73 56 65 | 72 73 69 6f 6e 2c 20 26 |vironsVe|rsion, &|
|00006190| 67 4d 61 63 29 3b 0d 09 | 0d 09 2f 2a 20 4d 61 6b |gMac);..|../* Mak|
|000061a0| 65 20 73 75 72 65 20 74 | 68 61 74 20 74 68 65 20 |e sure t|hat the |
|000061b0| 6d 61 63 68 69 6e 65 20 | 68 61 73 20 61 74 20 6c |machine |has at l|
|000061c0| 65 61 73 74 20 31 32 38 | 4b 20 52 4f 4d 73 2e 20 |east 128|K ROMs. |
|000061d0| 49 66 20 69 74 20 64 6f | 65 73 6e 27 74 2c 20 65 |If it do|esn't, e|
|000061e0| 78 69 74 2e 20 2a 2f 0d | 09 0d 09 69 66 20 28 67 |xit. */.|...if (g|
|000061f0| 4d 61 63 2e 6d 61 63 68 | 69 6e 65 54 79 70 65 20 |Mac.mach|ineType |
|00006200| 3c 20 30 29 20 41 6c 65 | 72 74 55 73 65 72 28 29 |< 0) Ale|rtUser()|
|00006210| 3b 0d 09 0d 09 2f 2a 09 | 31 2e 30 31 20 2d 20 57 |;..../*.|1.01 - W|
|00006220| 65 20 75 73 65 64 20 74 | 6f 20 6d 61 6b 65 20 61 |e used t|o make a|
|00006230| 20 63 68 65 63 6b 20 66 | 6f 72 20 6d 65 6d 6f 72 | check f|or memor|
|00006240| 79 20 61 74 20 74 68 69 | 73 20 70 6f 69 6e 74 20 |y at thi|s point |
|00006250| 62 79 20 65 78 61 6d 69 | 6e 69 6e 67 20 41 70 70 |by exami|ning App|
|00006260| 6c 4c 69 6d 69 74 2c 0d | 09 09 41 70 70 6c 69 63 |lLimit,.|..Applic|
|00006270| 5a 6f 6e 65 2c 20 61 6e | 64 20 53 74 61 63 6b 53 |Zone, an|d StackS|
|00006280| 70 61 63 65 20 61 6e 64 | 20 63 6f 6d 70 61 72 69 |pace and| compari|
|00006290| 6e 67 20 74 68 61 74 20 | 74 6f 20 74 68 65 20 6d |ng that |to the m|
|000062a0| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 77 65 20 74 |inimum s|ize we t|
|000062b0| 6f 6c 64 0d 09 09 4d 75 | 6c 74 69 46 69 6e 64 65 |old...Mu|ltiFinde|
|000062c0| 72 20 77 65 20 6e 65 65 | 64 65 64 2e 20 54 68 69 |r we nee|ded. Thi|
|000062d0| 73 20 64 69 64 20 6e 6f | 74 20 77 6f 72 6b 20 77 |s did no|t work w|
|000062e0| 65 6c 6c 20 62 65 63 61 | 75 73 65 20 69 74 20 61 |ell beca|use it a|
|000062f0| 73 73 75 6d 65 64 20 74 | 6f 6f 20 6d 75 63 68 20 |ssumed t|oo much |
|00006300| 61 62 6f 75 74 0d 09 09 | 74 68 65 20 72 65 6c 61 |about...|the rela|
|00006310| 74 69 6f 6e 73 68 69 70 | 20 62 65 74 77 65 65 6e |tionship| between|
|00006320| 20 77 68 61 74 20 77 65 | 20 61 73 6b 65 64 20 4d | what we| asked M|
|00006330| 75 6c 74 69 46 69 6e 64 | 65 72 20 66 6f 72 20 61 |ultiFind|er for a|
|00006340| 6e 64 20 77 68 61 74 20 | 77 65 20 77 6f 75 6c 64 |nd what |we would|
|00006350| 20 61 63 74 75 61 6c 6c | 79 0d 09 09 67 65 74 20 | actuall|y...get |
|00006360| 62 61 63 6b 2c 20 61 73 | 20 77 65 6c 6c 20 61 73 |back, as| well as|
|00006370| 20 68 6f 77 20 74 6f 20 | 6d 65 61 73 75 72 65 20 | how to |measure |
|00006380| 69 74 2e 20 49 6e 73 74 | 65 61 64 2c 20 77 65 20 |it. Inst|ead, we |
|00006390| 77 69 6c 6c 20 75 73 65 | 20 61 6e 20 61 6c 74 65 |will use| an alte|
|000063a0| 72 6e 61 74 65 0d 09 09 | 6d 65 74 68 6f 64 20 63 |rnate...|method c|
|000063b0| 6f 6d 70 72 69 73 65 64 | 20 6f 66 20 74 77 6f 20 |omprised| of two |
|000063c0| 73 74 65 70 73 2e 20 2a | 2f 0d 09 20 0d 09 2f 2a |steps. *|/.. ../*|
|000063d0| 09 49 74 20 69 73 20 62 | 65 74 74 65 72 20 74 6f |.It is b|etter to|
|000063e0| 20 66 69 72 73 74 20 63 | 68 65 63 6b 20 74 68 65 | first c|heck the|
|000063f0| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 61 70 70 | size of| the app|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.